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!

Append table with data from a form 1

Status
Not open for further replies.

0212

Technical User
Apr 2, 2003
115
0
0
US
Hi, all! Hopefully, you can help. I want to automatically insert information into several tables from a form. I want the records appended after I create a new record. I have developed the following code:

Private Sub Form_AfterInsert()
Dim mySQL As String
mySQL = "Insert INTO Policy Information (AcctID,PolicyCmts)"
mySQL = mySQL + " Values (& Me.AcctID &, '& Me.Account_Name &')"
End Sub

The code appears to run fine. However, a record is not appended to the Policy Information Table. Any ideas? Thanks in advance!
 
what about this ?
Code:
Private Sub Form_AfterInsert()
Dim mySQL As String
mySQL = "INSERT INTO [Policy Information] (AcctID,PolicyCmts)"
mySQL = mySQL & " VALUES (" & Me!AcctID & ",'" & Me!Account_Name & "')"
DoCmd.RunSQL mySQL
End Sub

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks, again, PHV! I really appreciate you help!!

Jim.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top