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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IF statement for a combo box 1

Status
Not open for further replies.

PharmaFun

Programmer
Jul 30, 2003
30
CA
Hi there,

I have a combobox in a form tied to a table called "A." I also have a Table "B." What I want is an IF statement for the combo box, so if a value is selected that exists in table "B" and not "A" only fields 1-5 on the form are filled in with data from tabke "B." Otherwise, if the value also pre-exists in table "A", all fields in the form are propogated. Does this make any sense?

Thanks,
Dino
 
Dino,

Are you using a union query to get data from both tables into the combo box? If so, add a field to each of them, in the query, to indicate the table it comes from:
"'A' as SourceTable"

Do the tables have the same fields in them? If so, put the data all in one table, with an extra field to differentiate between the two sets of data, and include that in the combobox's rowsource.

Once you've got one of those two methods going, check out the column property of a combo box in the help files. You'll be able to use that to get to the extra field (which you'll want to hide, by setting its width to zero). In the afterupdate event of the combo you can hide one set of fields or the other, depending on the value in the column that holds that extra field.

Jeremy

==
Jeremy Wallace
AlphaBet City Dataworks
Access Databases for Non-Profit Organizations

Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top