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

Open form if data in second table not found

Status
Not open for further replies.

pd06498

IS-IT--Management
Dec 10, 2003
36
AU
This question has probably already been answered but I can't find it so...
I have a database with several tables and associated forms. In the main form, I enter most data and when I get to a field that has data from another table, I select from a list box. I would like to be able to search for this data, and if it is not there, be able to open the input form for that table to enter the required data and when complete, close the second form and return to the original one to select the newly input data. Does this make sense? Can anyone help.
I am not to flash with programming.
I am using Access 2000.
Thanks in advance.
 
Hi

If I am understanding you right this is quite simple- you can even do it with a macro if you want, although I hate the things and prefer to code. I think you are saying you have an input form, and on this form you have a list box which is based on another table? And if the entry you want is not present in the list box, you want to be able to add it and then go back to your input form and select the new entry?

You need these steps:

1. A button near your list box which you can click to open your other input form, based on the second table, and move it to a new record.

2. After inputting the new record, close the second form.

3) When closing the form, you need to ensure the listbox on your first form is requeried to show the newly added data. You can use the requery action in a macro, or use code:
Forms![nameofform]![nameoflistbox].Requery

You could get flashier of you want e.g. add a line to your listbox table called 'Add New' and if the user selects this, then trigger the above events etc- let me know if you need more info


Nigel
Didn't someone say work is supposed to be fun? They didn't have computers then I guess....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top