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

Automatically Adding Data to a Form

Status
Not open for further replies.

TheTomCat

Programmer
Aug 25, 2004
73
US
I have designed a database in which the user enters all kinds of data into the forms then prints out Report forms.
Anyway, I have it set up now so that if you enter a person's data (one time) in a Master Index Form, then their inormation shows up in combo boxes in the Form. In other words, as long as the Data is input into the Master Index once, you never have to retype it again. All the user does is select the name from a Combo Box and click on the name. It then automatically enters all pertinent data in the fields for you. (i.e., Victim's name, address, phone ,etc.).

I deally, what I would like to happen is for a person to NOT have to add data to the Master Index first. I would like for them to open (i.e., Incident Report), type in the person's data in the appropriate fields, (i.e., Victim), then click on a Button to then Add that person to the Master Index.

I hope this made some sense.

Thomas Bailey
a/k/a TomCat
 
To do it with a button, you just need to capture all the data currently in the fields and copy it to a new record

Code:
MyButton_Onclick
dim dbs as database, rst as recordset
set dbs=currentdb
set rst=dbs.openrecordset("SELECT * FROM MasterTable")
rst.addnew
rst!name=me!name
rst!address1=me!address1
etc
...
rst.update
exit sub

As mentioned above, you can use NotInList to do this automatically, although you may want to confirm it. In that case, you would only copy 1 field at a time.

The other option is base the dropdown on the same table the form is based on. Effectively, use the records themselves as the source. You will need to ensure they return the correct unique record.

SeeThru
Synergy Connections Ltd - Telemarketing Services
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top