When attempting to insert a vba Date obtained from the Now function, I get the error:
"Wrong number of arguments or invalid property assignment"
Since I counted the parameters already I'm going to have to assume this has to do with trying to assign the date to the parameter v_logdate below:
Dim timeOfExecution As Date
timeOfExecution = Now
' ...
' INSERT a log record that says that this guy was
Dim qdef1 As DAO.QueryDef
Set qdef1 = db.QueryDefs("InsertAllTimeSyncLogRecord")
With qdef
' ...set some other parameters
.Parameters("v_logdate").Value = timeOfExecution ' timeOfExecution
' ...set some other parameters
End With
qdef1.Execute , dbFailOnError
My insert statement (InsertAllTimeSyncLogRecord) looks like this:
In the AllTimeSyncLog table the LogDate field the parameter will be inserted into is a Date/Time type.
INSERT INTO AllTimeSyncLog (
abradcwhash, hash, LogDate, firstname, lastname,
cohortid, email, department, [password], method, username
)
VALUES (
v_abradcwhash, v_hash, v_logdate, v_firstname, v_lastname,
v_cohortid, v_email, v_department, v_password, v_method, v_username
);
Is there some other way that I need to be assigning the timeOfExecution Date to the v_logdate parameter in my InsertAllTimeSyncLogRecord DAO.QueryDef?
qdef1, but then you useqdef(without the trailing1) in yourwithclause. Is this a typo translating to SO or the source of your problem?'" & Format(Now, "yyyy-mm-dd hh:nn:ss") & "'