passing value from a button to a combo in different forms.

hyousef

Registered User.
Local time
Today, 10:27
Joined
Jan 15, 2002
Messages
41
I have 2 forms, Form1 and Form2.
Form1 has 5 command buttons, all of them take a user to Form2 but they are different areas for example: Button1(Area1), Button2(Area2)...etc. when a user press button1(Area1) then Form2 opens and has data related only to area1. If a user press button2(Area2)then Form2 opens and has data related only to area2 and so on.

In Form2, I have some text boxes and [Area Combo box] the area combo contains all the 5 areas but filtered and its property source is LocationID which is taken from table(Area) and in property Row Source, there is a query to get the areas.

My problem is that if there is no records related to a particular area then all fields in form2 will be empty which is ok so users can enter new records

but in case of empty fields or null records how can i :
show area in the area combo automatically when a user select a button form Form1. For example, if a user press button3(Area3) from Form1 then form2 will open showing Area3 in the [Area Combo box].

Thanks in advance.
 
Use the bound column of your combobox, or any one or more columns for that matter, in the criteria for the (manually built) SQL statement which is the recordsource for your subform. Requery the subform on each "AfterUpdate" event of the combobox. If no data is present in the subform, you'll get a blank record.
 
There is no any subform....i have form1 and form2....I need to pass area from "a command button area" in form1 to a "combo area" in form2.
i know how to do it If there is already data in form2 that related to a selected area.

but
If no data is present in form2 that related to the selected area, then i get a blank record which is fine but not with the combo...I need to show the selected area in the combo and the other empty records a user can fill it.
 

Users who are viewing this thread

Back
Top Bottom