Really need some help with simple question

crann

Registered User.
Local time
Today, 15:42
Joined
Nov 23, 2002
Messages
160
Hi people getting on ok with database but cant remeber how i display info in one text box based on what i enter in another box.

Here what i nned to do:

I have a table of store number and store names.

I want 2 text boxes. when a user keys in a store number to related store name apperas in the other text box.

Simple as that, but its driving me mad trying to work it out.


any help grateful.

Jon
 
How to automatically fill a textbox

Hey Jon,

I've had this problem before, and managed to solve it by doing this:

Ideally you want the Store Number field to be a combobox – simply click on Format; Change To; ComboBox.

This combobox should have 2 columns - the store number first and the store name second. The bound column should be 1, and you can choose whether to display the store name or not by having the column count set to 1 or 2.

Then because the Store Name field is bound to a table you will need to use VBA code on the AfterUpdate event of the cboStoreNumber combo box to place the desired value into the txtStoreName textbox.


' ***** Code Start *****
Private Sub cboStoreNumber _AfterUpdate()
Me. txtStoreName.Value = Me.cboStoreNumber.Column(1)
End Sub
' ***** Code End *****

(Note that the Column property of a combo box is "zero-based," meaning that the first column (field) in the combo box's Row Source is column 0, the second column is column 1, etc).

Now when you make a selection of a Store's ID in the combo box, the textbox will automatically display the store's name.

Hope that helps,

Rusty
:D Hee, hee - chamone!!
 

Users who are viewing this thread

Back
Top Bottom