belovedcej
Programmer
I am unfamiliar with DAO objects, though I have been reading up on them. I have mostly used ADO (though i'm very new to that, too.). My db is using linked tables to an Access backend.
Anyway, I need to save a record and return the id (unbound form.)
I have basically the following code:
The last line will not compile - I get the message that a variable or function is expected, and it breaks on .Execute. However, my record does save, so the problem isn't in my insert statement.
I have tried any number of things, and this is the closest I've gotten. Any ideas? I'm willing to change the approach if necessary, but if I need to work with recordset objects, I have to stick with DAO in this case.
Thanks.
Anyway, I need to save a record and return the id (unbound form.)
I have basically the following code:
Code:
Public Function saveDonation(my incoming parameters)
Dim strSQL As String
strSQL = my insert statement
CurrentDb.Execute strSQL, dbFailOnError
strSQL = "SELECT @@IDENTITY" & ";"
saveDonation = CurrentDb.Execute(strSQL, dbFailOnError)
End Function
The last line will not compile - I get the message that a variable or function is expected, and it breaks on .Execute. However, my record does save, so the problem isn't in my insert statement.
I have tried any number of things, and this is the closest I've gotten. Any ideas? I'm willing to change the approach if necessary, but if I need to work with recordset objects, I have to stick with DAO in this case.
Thanks.