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

Been a while (years) 1

Status
Not open for further replies.

cranebill

IS-IT--Management
Jan 4, 2002
1,113
0
0
US
Anyway I will be building a form that has several fields on it, I would like to add these fields to a table using a command button so that when I click on the button it inserts the data, closes the form, and then moves on.

I looked on the prefab databases for a refresher and got nowhere. so I created a button, viewed the onclick event and this is what I got:

Private Sub Command4_Click()
On Error GoTo Err_Command4_Click


DoCmd.GoToRecord , , acNewRec

Exit_Command4_Click:
Exit Sub

Err_Command4_Click:
MsgBox Err.Description
Resume Exit_Command4_Click

End Sub


Where can I amnually add sql or how do I manually add an insert staement to this?
 
If you have bound the form to the table, data will be inserted and updated by Access, no SQL required.
 
put the sql just above the DoCmd.GoToRecord , , acNewRec line
something like...

docmd.runSQL "update SQL string "

Ian Mayor (UK)
Program Error
Programming is 1% coding, 50% error checking and 49% sweat as your application bombs out in front of the client.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top