Hi Everyone.
I am busy building a VB 6 APP that will access a MS Access database. For the sake of this problem I will abreviate the DB. It has two tables. the main table has 6 bound text boxes to a data control. They work fine on there own. My issue is that I have added a drop down combo which accesses the other table in MS Access. I populate the drop down using a command button on the form with the textboxes using the additem for the combo and rs.fields.value to populate the combobox. I want users only to be able to select an item from the combo which must populate the one textbox and then they can fill in the rest of the fields normally. I am new at using VB to create a frontend for a DB as I normally use VB for excel manipulation so I am struggling to figure this out. I cannot find any help in my documentation so hopefully someone can point me in the right direction.
Thanks in advance for taking the time.
Craig Allan

Use the click event of the combo and set the text of the text box to the text of the combo box...

Text1.Text = Combo1.Text

Good Luck

Hi and thanks for you response vb5prgrmr.
I am having a problem posting so hopefully this goes through.
I tried this code before but if I change the name of the bound textbox ( as all my textboxes are named "textfields") and use the anything.text = comboanything.text then it returns the error "compile error:method or data member not found". My concept is that the users will update one table for "company types" and then the form I am having issues with will allow them to select a company type from the dropdown and the click event of the combo will populate the bound textbox "company type". saves the user from making mistakes etc. My problem is that i cannot populate that textbox.
I have noticed that the only options I have for these textboxes is "count-item-lbound-ubound".
I hope this reply makes sense and thanks again.
Craig

Hi vb5prgrmr.
I am not using arrays. All i did was create a data form in VB6 using the new form data wizard and pointed it to the table in access that i want to update. So basically all it is, is a data form created by VB6 wizard and a drop down combo which I populate using a command button with the following code..
Dim DB As Database
Dim RS As Recordset

Set DB = OpenDatabase("c:\sapug\sapug.mdb")
Set RS = DB.OpenRecordset("new sig", dbOpenSnapshot)

ComboSIGList.Clear


Do
ComboSIGList.AddItem RS.Fields("com name").Value
RS.MoveNext
Loop While Not RS.EOF

This works perfect as i said but I need to update the "com name" field which was created by VB6 data form wizard.
regards
Craig

Okay, I just refreshed my memory on the Data Form Wizard and refreshed my memory on what you said...

>( as all my textboxes are named "textfields")

Which means your textboxes are an array and to double check I used the wizard to make sure that it creates an array of textboxes. SO YES you have an array of text boxes as they are all named "textFields"!

So to pass the combo's text to one of the text box controls you will need to use it's index!

Text1(Index).Text = Combo1.Text


Good Luck

hi vb5prgrmr.
Thanks a bunch. My problem is solved. I am not sure how to post a "solved" message but just so you know I appreciate your expert help.
Best Regards
Craig Allan

This question has already been answered. Start a new discussion instead.