Combo box...to query...to output on Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a text box that someone can input a vendor number into. They can then
press a button that takes that vendor number and plugs it into my query. When
the query runs it produces the vendor info (address, phone #...etc)

The problem is that it just brings up this info in query datasheet view. I
could have it bring up a report, but my ultimate goal is to have it come up
directly on the form itself. Is this possible?
 
This can be achieved using a combo box as follows.
The combo's RowSource SQL needs to pick up all the
information that you wish to publish on the form e.g.
SELECT vendorNumber, vendorName, addressLine1, addressLine2
FROM tblVendor etc
The ColumnCount needs to be set to match the number of
columns in the SELECT statement. The columnWidths need to
be set so that only those columns that help the user select
the required info are shown e.g. 1;3;0;0;0;0 would result
in only the vendor number and name being shown.
Then code needs to be placed in the combo's AfterUpdate
eventhandler to populate the form based on the user's
selection. This is done using the combo's Column (zero
based)collection e.g.
txtVendorName = cmbVendor.Column(1)
txtAddressLine1 = cmbVendor.Column(2)
etc

Hope This Helps
Gerald Stanley MCSD
 
Back
Top