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

Append Query - need data from another table

Status
Not open for further replies.

crystalreporting

Instructor
Feb 13, 2003
649
NZ
I have a simple form. When the values on the form are filled in I have a button with an event that runs a macro that contains several append/update queries.

One of the append queries adds a record containing the informtation entered on the form. Within the table being written to is a document number. The next document number is held in a separate 'control' file. The append query needs to lookup the control file to establish the next document number to use when appending the record. How do I do this?

My final query in the macro updates the control file and increments the next document number field.

I am wrting my application over an exisiting database so using an autonumber or some other method instead of the control file is not an option.

Thanks! Peter.

Peter Shirley
 
Perhaps something like:

[tt]intNextDoc=DMax("DocID","tblDocuments")
strSQL="INSERT INTO tblTable ( DocID, Field1 ) " _
& "VALUES ( " & intNextDoc & ", '" & Me.txtText1 & "' )"
DoCmd.Run strSQL[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top