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

Access 97: Using Combo Box to look up or add new record

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi all,

I have a form that I set up, and want to use a combo box (Called: 'Name') to do 2 things:

First, if the name exists, pulling it down calls up the rest of the data and displays it in the form, where I can add/view various subform info.

However, if the 'Name' does not appear in the list, I would like it to allow the user to enter a new 'Name' in that field (As well as susequent data field in that form, such as address etc).

Does that make sense? Not sure I explained it well.

I tried to turn off the 'Limit toList' proprty for that field, but I recieved an error that it couldn't because the Column Widths don't match (The Combo Box is bound to the second column in a table, the first being an indexed auto number).

I'm a bit Access-Impaired, but will try to understand any help you might be able to give me :)

Thanks!
Hayle
 
Perhaps I should clarify;

The combo box should allow either to select a 'Name' from the Box, or the user to enter a new one, to force the whole form to an 'add new' state.

I know I'm probably not using the correct terminology. It seems like it should be simple enough, yet I haven't been able to figure it out on my own, or find it in the FAQ's. Again, that's probably because I don't know the terminology.

Thanks in advance,
Hayle
 
The problems sems to be that you've bound the combo box to another table. In this case I would keep what you have but hide the combobox. Then overlay it with a new one that imports both the names from the first combo box as well as allowing you to insert new names.

Set up your code to search the name in combo 2 against the names in the other tables. If there's a match then select the appropraite data and fill your fields. If there is no match then enter an append mode to accept the new data.
 
Thanks Gamesman, did I mention I am pretty much Access-Inept?

Is there some documentation that might walk a moron like me through this?

Thanks for the answer!
Hayle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top