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

populating with combobox

Status
Not open for further replies.

zestril5

Technical User
Sep 30, 2002
102
0
0
US
When I try to populate a form's fields from a combobox it works ok for the first of the two fields being populated all the time but it only works the first time for the second field being populated.
The combobox has vendor name, item no, and description. When I enter a new record all is well unless I try to correct an error by going back and selecting another choice from the combobox. Then, Only the item number is correctly chosen. The description stays the same as the previous choice.

for example .. I choose from the combobox Joe, 1234, apples.
If I go back to the combo box because I should have chosen Joe, 4321, oranges, only Joe and 4321 are correct the description field will retain the apples description.

I’m sure it’s something really simple but I’m very new to this and have only found information on populating 2 fields instead of three

Here is the code I used.

Option Compare Database


Private Sub Combo23_AfterUpdate()
Me.Item_No = Me.Combo23.Column(1)
Me.Description = Me.Combo23.Column(2)
End Sub

Private Sub Combo23_BeforeUpdate(Cancel As Integer)

End Sub

 
What is the RowSource of Combo23 ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
How are ya zestril5 . . . .

What method are you using to copy the data from the Combo?

cal.gif
See Ya! . . . . . .
 
The rowsource is as follows
Select [items].[name],[items].[item no],[items].[description]From items;

I'm not sure I understand what you mean by what method I'm using.
The Name is enterd from the combo directly which was set up in the combobox setup. the others are done with the code
above.
 
zestril5 . . . . .

First try changing the [blue] Dot Operators (.)[/blue] after each [blue]Me[/blue] to the [blue]Bang Operator (!)[/blue], as follows:
Code:
[blue]Private Sub Combo23_AfterUpdate()
   Me[red]![/red]Item_No = Me[red]![/red]Combo23.Column(1)
   Me[red]![/red]Description = Me[red]![/red]Combo23.Column(2)
End Sub[/blue]


cal.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top