Making Field Visible/Invisible

  • Thread starter Thread starter Jonathan Smith
  • Start date Start date
J

Jonathan Smith

Using Access 2002, in a Windows XP Environment:

I have the following fields:

cmbActivityCode
cmbClient
cmbStudent

If cmbActivityCode is a certain Set of Values, I want cmbClient to be
visible. If cmbActivityCode is another Set of Values, I want smbStudent
to be visible.

Or, if I could change the source of the cmbClient field, based on the
value of cmbActivityCode ...

if cmbActivityCode = 1001 then cmbClient is from tbl3001
if cmbActivityCode = 1003 then cmbClient is from tbl0502

I think I may have asked this question previously, but I cannot find the
answer ...

HELP, please!!!!!!!!!!!!!!!!!!
 
To get the value of the combo, use .Value.

So... Place code like this in the afterupdate event of the combo box :

sValue = me.cmbActivityCode.value
if (sValue = "code 1" or svalue = "code 2" ) then
me.cmbClient.Visible = false
me.cmbStudent.Visible = true
end if
if (sValue = "code 3" or sValue = "code 4") then
me.cmbClient.Visible = true
me.cmbStudent.Visible = false
end if

To set which table is used for a particular combo use the rowsource,
and make sure that "table/query" is set as the rowsource type.

if (sValue = "code 3") then
me.cmbClient.rowsoure = " select col_1, col_2 from tbl3001 "
end if
if (sValue = "code 4") then
me.cmbClient.rowsource = "..."
end if

- Andrew Backer

Using Access 2002, in a Windows XP Environment:

I have the following fields:

cmbActivityCode
cmbClient
cmbStudent

If cmbActivityCode is a certain Set of Values, I want cmbClient to be
visible. If cmbActivityCode is another Set of Values, I want smbStudent
to be visible.

Or, if I could change the source of the cmbClient field, based on the
value of cmbActivityCode ...

if cmbActivityCode = 1001 then cmbClient is from tbl3001
if cmbActivityCode = 1003 then cmbClient is from tbl0502

I think I may have asked this question previously, but I cannot find the
answer ...

HELP, please!!!!!!!!!!!!!!!!!!

..--------------------------------------
| Andrew Backer
| abacker _@_ comcast _dot_ net
`--
 
Jonathan

You can do it either way. On the AfterUpdate event of cmbActivityCode...

Me.cmbClient.Visible = Me.cmbActivityCode = 1001
Me.cmbStudent.Visible = Me.cmbActivityCode = 1003

.... or...

With Me.cmbClient
Select Case Me.cmbActivityCode
Case 1001
.RowSource = "tbl3001"
Case 1003
.RowSource = "tbl0502"
End Select
End With
 
Thank you Andrew.

To get the value of the combo, use .Value.

So... Place code like this in the afterupdate event of the combo box :

sValue = me.cmbActivityCode.value
if (sValue = "code 1" or svalue = "code 2" ) then
me.cmbClient.Visible = false
me.cmbStudent.Visible = true
end if
if (sValue = "code 3" or sValue = "code 4") then
me.cmbClient.Visible = true
me.cmbStudent.Visible = false
end if

To set which table is used for a particular combo use the rowsource,
and make sure that "table/query" is set as the rowsource type.

if (sValue = "code 3") then
me.cmbClient.rowsoure = " select col_1, col_2 from tbl3001 "
end if
if (sValue = "code 4") then
me.cmbClient.rowsource = "..."
end if

- Andrew Backer



.--------------------------------------
| Andrew Backer
| abacker _@_ comcast _dot_ net
`--
 
Back
Top