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

Field List Combo Box

Status
Not open for further replies.

Brockers

Instructor
Jul 27, 2002
13
GB
I have a combo box on a form which displays the list of fields for that form. When I make a selection I want it to fill out the value of the field selected into a text box below. At the moment I have managed to return the name of the field, but not the value with the code given below. The combo is Combo6 and the text box Text8.


Private Sub Combo6_AfterUpdate()

Dim ItemAmmend As Object

Set ItemAmmend = Combo6

Text8 = ItemAmmend
End Sub

Any suggestions greatly appreciated.

Regards

Brockers
Instructor
New Horizons Manchester England
 
Private Sub Combo6_AfterUpdate()
Text8 = Combo6
End Sub

Will give Text8 the value of the bound column in the combobox.

Regards,
gkprogrammer
 
Thanks but it's not quite that simple or at least my head doesn't se it that way!

Lets say I have 3 fields F1, F2 and F3, F1 has a Entry of A, F2 = B, F3 = C F1, F2 and F3 are also the possible selections in the Unbound Combo so when I select F1 in the Combo I want an Unbound Text Box to = A when I selct F2 in the List it = B etc if I change the value of F1 to = H then the Unbound Text Box updates when I choose F1 in the Combo!

I think it's probably the hardest problem to explain ever but I'm hoping the answer is straight forward! It's not even my problem, it's a student of mines!!!!!

Regards

Brockers
Instructor
New Horizons Manchester England
 
If I understand what you're asking, the contents of combo box (Combo6) are the names of fields, such as "F1", "F2", and "F3". The user will then select one of the FieldNames from the Combobox and you then want the value of that field to go into a textbox (Text8).

When you say that field "F1" has a value of "A", what is, or where is that relationship established. Is "F1" another textbox on the form with a value of "A", or is "F1" a field from a table loaded into the form's recordset, or is it something else entirely?

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Sorry guys, I've solved it!!!! a Dlookup!

Private Sub Combo6_AfterUpdate()

DoCmd.RunCommand acCmdRefresh

Text8 = DLookup(Combo6, "tblFields")


End Sub

The refresh updates the Text Box if you change the field value!

Regards

Brockers
Instructor
New Horizons Manchester England
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top