Associating a Variable with Table Data

zooropa66

Registered User.
Local time
Today, 23:37
Joined
Nov 23, 2010
Messages
61
Hello,
This is my first post on this forum so sorry if i make any mistakes:

I have a table with 2 fields:

my_id (Autonumber, primary key)
my_test (Yes / No)

e.g.

my_id my_test
1 No
2 Yes
3 No

I've replaced the normal checkboxes with No and Yes above

I also have a form and this contains a combo with the my_id and my_test fields displayed in the dropdown.

When the user selects on of these e.g. my_id=2 then i'd like to create a variable myVar that is set to the value of my_test so in this example my_test = Yes (i think this would set myVar to zero whereas a No would set myVar to -1).

Could anyone tell me how i can associate a variable with an id that's been selected from a combo (that's been looked up in a table)

Many Thanks
 
In the After Update event of the combo box:
Code:
MyVar = Me.MyComboBoxNameHere

or if you have Yes/No and want to assign it the actual normal values associated:
Code:
Select Case Me.MyComboBoxNameHere
  Case "Yes"
     MyVar = -1
  Case "No"
     MyVar = 0
End Select
 

Users who are viewing this thread

Back
Top Bottom