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

Insert record at end of temporary table in a subform 1

Status
Not open for further replies.

Delano29

Technical User
Jul 10, 2001
28
US

Hi,

I am using Access 2003. The code below is attached to a command button that is suppose to attach a record to the bottom of a temporary table when pressed. The table is displayed in a subform but most of the info. to be attached in the code comes from fields in the main form.

The temporary table is created when the form is opened and cleared when closed. But for some reason that I don't understand the record is inserted into various places in the temporary table everytime the command button is pressed. Sometimes it's in the beginning, middle or end. I need the fields/record to be inserted at the end of the temporary table at all times.

Is there a way of forcing it to append to the bottom of the table in the subform?

Thanks in advance.


DoCmd.RunSQL "INSERT INTO TEMPWEAPONTBL (AGENT_ID, AGENT_LAST, AGENT_FIRST, GROUP_NAME, SERIAL) VALUES (FORMS!RANGESCRENTF!AGENT_ID, FORMS!RANGESCRENTF!AGENT_LAST, FORMS!RANGESCRENTF!AGENT_FIRST, FORMS!RANGESCRENTF!GROUP_NAME, 'RANGE-ONLY')"
 
A relational database does not store a record in any order.
You would need to add some sort of ordering column to the table. Either a autonumber or a datetime stamp then sort the subforms recordset by that field
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top