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!

Form update sequel not working

Status
Not open for further replies.

rmtiptoes

IS-IT--Management
Mar 30, 2004
55
US
Can anyone tell me why this event procedure won't work"?
The error is that the Exp1 is an unknown field but this works in the query builder. I need to insert the current date.

Private Sub Comments_AfterUpdate()
Dim db As Database

Set db = CurrentDb
db.Execute "INSERT INTO [Comments] " _
& " SELECT [Assets].[Mylan Asset ID Number], [Assets].[PO Number], Date() AS Expr1,[Assets].Comments FROM [Assets] WHERE " _
& " [Assets].[Mylan Asset ID Number]=" & Me![Mylan Asset ID Number] & ";"
Set db = Nothing
End Sub


Homer: But every time I learn something new, it pushes out something old! Remember that time I took a home wine-making course and forgot how to drive?
Marge Simpson: That's because you were drunk!
Homer: And how.

 
How are ya rmtiptoes . . . . .

Try this:
Code:
[blue]Private Sub Comments_AfterUpdate()
   Dim db As Database

   Set db = CurrentDb
   db.Execute "INSERT INTO ([Comments]) " & _
              "Value [Mylan Asset ID Number] " & ", " & _
                    "[PO Number] " & ", " & _
                    "Date() " & _
              "FROM [Assets] " & _
              "WHERE [Mylan Asset ID Number]=" & Me![Mylan Asset ID Number] & ";"
   Set db = Nothing
End Sub[/blue]

Calvin.gif
See Ya! . . . . . .
 
The answer is here: thread702-1048346

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top