Form/Subform question

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

Guest

I have a form containing a subform that relates on a customer name. I need to
be able to choose a customer and show the related orders for that customer in
the subform. I have it to where it does show the related orders, but my goal
is to have the customer field on the form set up to where I can type in the
first letter and give me a drop down of those with that letter... to autofill
if I have more than one letter...until I find the correct customer. Right now
I can only scroll through the list on that field... there are over 2000
customers, I really would rather have a better way of pulling up a specific
customer. Any clues???? PLEASE????!??!?!?!!!!!! I think I've done this in the
past, but it's been a LONG time ago and I'm just getting back into Access
after a long break and have forgotten alot of what I knew. HELP!!! Thank
you!!!
 
Hi, KDG.

While it *would* be possible to actually change the combo box' RowSource
after each letter using the Change event, if the combo box' rows are sorted
and its AutoExpand property is set to Yes, it's probably not necessary.
AutoExpand will fill in as many characters as it can, until there's a tie,
providing an efficient way to narrow it down to the desired customer.

You can also drop the combo box down and allow an efficient scroll to the
user by using the Dropdown method. In the combo box' OnGotFocus event, add
the code:

Me!YourComboBox.Dropdown

Hope that helps.

Sprinks
 
Thank you for responding... and I wish that I hadn't already tried those
things. I do have it set to autoexpand and I tried your me! code, but that
didn't do anything either. I can't get anything out of my combo box except
the list from my table that I can scroll through. Could it be something with
the form properties, or should I have an underlying query of some sort that
helps this thing run???? I feel so lost and alone <sigh>... Thanks for
trying... I'm open toany new suggestions, but I may end up doing this some
other way if I can't figure it out. I thought this would be the best setup
for the end user, that's all...
 
KDG,

Somehow I'm missing something. First when you say "scroll through", do you
mean scroll through the combo box dropdown list, or "scroll through" all of
your records? If you mean the latter, then you need a "lookup" combo box
(unbound) having the same RowSource as your Customer box, in which you can
enter a value, and then use the value to go to the correct record. A handy
place for it is either on the form header, or on a popup form which you open
in response to a "Lookup Customer" command button.

In either case, use the Openform method with the criteria to go to the
correct record:

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "YourFormName"

stLinkCriteria = "[CompanyID]=" & Me![YourComboBox]
DoCmd.OpenForm stDocName, , , stLinkCriteria

When you say the .Dropdown method did nothing, are you saying that the list
did not drop down on entering the field? If so, are you sure you changed
"YourComboBox" to the name of your combo box?

If this doesn't help, please post the following properties of your current
combo box:
ControlSource
RowSource
BoundColumn
ColumnWidths

Sprinks
 
Back
Top