I have a Member Details form and when I add a new member I want to be able to add a record to a second table for that member with some default information.
I have the following VBA code:
Private Sub btnNewRegistration_Click()
If Me.Dirty Then Me.Dirty = False
CurrentDb.Execute "INSERT INTO Registration(ID, PrID, ProgramFee) SELECT " & Me.ID & " AS ID, PrID, ProgramFee FROM Programs WHERE PrID = " & GetDefaultProgram()
End Sub
GetDefaultProgram() is a function defined in a module in the database that defines the record to use from the Programs table.
When I run it I get a compile error: sub or function not defined. When I debug it highlights the .ID portion of Me.ID.
Any suggestions to resolve this are appreciated.