R
RedHeadedMonster via AccessMonster.com
I've got the following code built onto an AfterUpdate event on a form:
Dim SQL As String
If CDRLID = 9 Or CDRLID = 10 Then
DoCmd.SetWarnings (0)
SQL = "INSERT INTO Notifier (ID, NameID)" & _
"VALUES (Me.ID, 99)"
DoCmd.RunSQL SQL
Else
End If
Basically, I want to automatically insert a NameID into my Notifier table if
the CDRLID = 9 or 10. Me.ID is Project ID on the current form.
When I run the code a message box comes up wanting me to enter the Me.ID
number. Other than that it works just the way I want. How the heck do I get
it to see and pull the ID number off the form to put into the Table.
I also tried:
Dim SQL As String
Dim xyz as Long
Set xyz = Me.ID
If CDRLID = 9 Or CDRLID = 10 Then
DoCmd.SetWarnings (0)
SQL = "INSERT INTO Notifier (ID, NameID)" & _
"VALUES (xyz, 99)"
DoCmd.RunSQL SQL
Else
End If
And get an object required error on the set xyz =
Any help, suggestions would be greatly appreciated.
RHM
Dim SQL As String
If CDRLID = 9 Or CDRLID = 10 Then
DoCmd.SetWarnings (0)
SQL = "INSERT INTO Notifier (ID, NameID)" & _
"VALUES (Me.ID, 99)"
DoCmd.RunSQL SQL
Else
End If
Basically, I want to automatically insert a NameID into my Notifier table if
the CDRLID = 9 or 10. Me.ID is Project ID on the current form.
When I run the code a message box comes up wanting me to enter the Me.ID
number. Other than that it works just the way I want. How the heck do I get
it to see and pull the ID number off the form to put into the Table.
I also tried:
Dim SQL As String
Dim xyz as Long
Set xyz = Me.ID
If CDRLID = 9 Or CDRLID = 10 Then
DoCmd.SetWarnings (0)
SQL = "INSERT INTO Notifier (ID, NameID)" & _
"VALUES (xyz, 99)"
DoCmd.RunSQL SQL
Else
End If
And get an object required error on the set xyz =
Any help, suggestions would be greatly appreciated.
RHM