Opening new form with specific item in drop down box

your code should be only this in the combo125_Afterupdate event
if you want to add additional states you can use the or clause like:

Code:
Private Sub Combo125_AfterUpdate()
If Combo125 = "CA"  or combo125 = "GA" Then
[Combo83].Visible = True
(for more combo's ) combo123.visible = true and so on...
Else
[Combo83].Visible = False
End If
End Sub
 
Well almost like a charm. I can get them to appear/disappear when I'm typing the data in manually. However, I am going to be using this form as a template and when I imported the data, the boxes did not automatically appear, even with CA,GA, MA selected. Any suggestions?
 
sorry but i don't understand what you want to do, perhaps i am not familiar with access templates....
 
I'm essentially importing data so that the state dropdown box is automatically filled. However, for example, if CA is automatically selected, the corresponding additional drop down boxes do not show up. To get them to show up, I had to delete the automatically dropped down CA value, and then retype it for it to show up and didn't know if there was a formatting issue that I could do to fix it.
 
set the default if thus dropdown's visible to false so only when you will select it from the dropdown it will show up
 
yeah it's currently on that setting. I'm not sure why it will not show up until I manually select CA from the dropdown box. In addition to not showing up until I manually type it in, if I go to a different record that is not CA after typing CA into the previous record (i.e. the boxes show up), the boxes remain visible even though the state is not CA. Does that makes some sense?
 
in the form_current event call the Combo125_AfterUpdate, so every time you go to the next record it will check the value and set the visible according
 
sorry but what do you mean by "call"? DoI put that code in the line "For Current" or do I have to enter it into code?
 
I'm not entirely sure if this is what you meant or not but for the form property sheet, I went to "On Current" and selected [Event Procedure] from the dropdown box.
 
thats correct, than open it on VBA and enter Cobo125_afterUpdate
 
Okay I'm sorry for not understanding this at all, but I did [Event Procedure] like I said, and then when I open VBA, I have the code already there from the dropdown boxes


Private Sub combo125_afterupdate()
If Combo125 = "CA" Then
[Combo39].Visible = True
[Combo41].Visible = True
[Combo43].Visible = True
[Label154].Visible = True
Else
[Combo39].Visible = False
[Combo41].Visible = False
[Combo43].Visible = False
[Label154].Visible = False
End If
If Combo125 = "GA" Then
[Combo45].Visible = True
[Combo50].Visible = True
[Combo52].Visible = True
[Combo54].Visible = True
[Combo180].Visible = True
[Label157].Visible = True
Else
[Combo45].Visible = False
[Combo50].Visible = False
[Combo52].Visible = False
[Combo54].Visible = False
[Combo180].Visible = False
[Label157].Visible = False
End If
If Combo125 = "MA" Then
[Combo56].Visible = True
[Combo58].Visible = True
[Combo60].Visible = True
[Label158].Visible = True
Else
[Combo56].Visible = False
[Combo58].Visible = False
[Combo60].Visible = False
[Label158].Visible = False
End If
End Sub
 
i am talking from the code for the Form_Current Event not the Combo125,

should look like this:

private sub Form_Current()
combo125_afterupdate()
end sub
 
When typing that code in, I keep getting a compile error reading a syntax error or expecting: =
 
remove parenthesis
combo125_afterupdate()
 

Users who are viewing this thread

Back
Top Bottom