Question Reg - Forms

gctsundar

Registered User.
Local time
Today, 22:39
Joined
Aug 7, 2008
Messages
17
Hi,

I Have The Following Requirment.

I Have A Table With 2 Columns...
Like
A 1
B 2
C 3
D 2
E 3

I Am Displaying All The Values In The 1st Column In A Form In A Combobox... If I Select A Particular Value It Ll Fetch The Corres Value Of The Second Column In A Textbox.

For Eg If I Select C In Combo It Ll Display 3...

What I Need Is I Have A Button In The Form.. If I Click The Button I Should Get The First Column Values Alone In Other Combobox Which Is Corresponding To The Value In The Textbox.

For Eg... Here.. 3 Is There In The Text Box.. If I Click The Button It Should Display C,e In The Combo Box...

Thanks,
Soms.
 
Hi,
Try this on the OnClick of your button:


Me!TEXTBOX = Me!COMBOBOX

Regards
James
 
I JUST WANTED TO PASS A VALUE IN THE QUERY AND BIND IT TO THE COMBO...

Combo71.RowSource = "select FIELD1 from
WHERE FIELD2= Me!Text62;"

BUT THE ABOVE CODE DOES NOT BIND THE VALUE IN THE COMBO.. CAN U PLS HELP ME ..?
 
Sorry, not sure about that at the moment - I am now out of the office until Monday so if you haven't had it solved I will have a think then
Regards
 
This wasen't easy to decipher :rolleyes: but if I understand correctly you have a form with 2 comboboxes and 1 textbox, correct?

combo1 has it's recordsource set something like this: SELECT table1.field1 FROM table1;

Now you would first like too lookup the value of field 2 in your table and insert it into your textbox, if so use a DLOOKUP in the afterupdate event of combo1.

Code:
Private Sub cmb1_AfterUpdate()
    Me.txt1 = DLookup("field2", "table1", "[field1]=  """ & Me.cmb1 & """")
End Sub

Watch out for the quotes in the Me.cmb1 it's there because of the textfield in cmb1.

Secondly you now want to have a button to fill in the recordsource of your 2. combobox based on the selection of 1.combo?

If that's the case the just set your 2.combo's recordsource in designview to: SELECT table1.field1 FROM table1 WHERE (((table1.field2)=forms!frm1!txt62)); and requery the combobox in your button's click_event

Code:
Private Sub button_Click()
    Me.combo71.Requery
End Sub

There is other methodes which are better but you then have to explain a little better. :cool:

JR
 
I JUST WANTED TO PASS A VALUE IN THE QUERY AND BIND IT TO THE COMBO...

Combo71.RowSource = "select FIELD1 from
WHERE FIELD2= Me!Text62;"

BUT THE ABOVE CODE DOES NOT BIND THE VALUE IN THE COMBO.. CAN U PLS HELP ME ..?



please try. assume the fields is a number type.
Code:
Combo71.RowSource = "select FIELD1 from [TABLE] WHERE FIELD2=" & Me!Text62
 

Users who are viewing this thread

Back
Top Bottom