Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get value from Combo box on subform

Status
Not open for further replies.

macdoggy

Technical User
Dec 21, 2007
12
US
Hello, Please help. I have a subform with a combo box. I want to look at the value in the combo box and show different controls depending on what that value is (for example, if the value is "Combo/list" or "3" I show a combo box for data entry, if it is "Text" or "1" I show a text box, etc).

The subform should already have control (I used docmd.gotocontrol and inserted a new record, so I should still be on that subform, right)?

I get an error saying that microsoft access can't find the field (the combo box I'm trying to look at).

Thanks for your help!
 
Why not posting your actual code ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
How are ya macdoggy . . .

I can only reply with the same [blue]vague[/blue] demeanor. The [blue]AfterUpdate[/blue] event of the combobox should resemble:
Code:
[blue]   Dim CBx As ComboBox
   
   Set CBx = Me![purple][b]ComboboxName[/b][/purple]
   
   If CBx.Column(0) = 1 Then
      [green]'Your code to enable Textbox[/green]
   ElseIf CBx.Column(0) = 3 Then
      [green]'Your code to enable Combobox[/green]
   ElseIf CBx.Column(0) = [purple][b]AnotherNumber[/b][/purple] Then
      [green]'Your code to enable Something Else[/green]
   End If

   Set CBx = Nothing[/blue]
[blue]Note: Column index starts at zero . . .[/blue]

Be sure to read the links provided by [blue]PHV[/blue] if you prefer faster resolution of your problems . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top