Marko Stojovic
Registered User.
- Local time
- Today, 12:30
- Joined
- Jan 25, 2001
- Messages
- 29
Hi there.
I was wondering if you could help me. There is a certain query which simply doesn't work when I try it in a module. However, if I transfer it into the query window and press the exclamation mark, it DOES work. Here is the text (Access 97, by the way):
Dim qryN As QueryDef
Dim MyDate As Date
MyDate = Left(Now, 8)
Set qryN = CurrentDb.CreateQueryDef("", "update [q3-2000-01 response] set " & _
"[from (new)]=#" & MyDate & "# where project_id='" & Me.project_id.Value & "'")
MsgBox qryN.SQL
qryN.Execute
MsgBox qryN.RecordsAffected
(I had to get the current date that way because when I use Mydate=Date it gives a null. During execution, Mydate evaluates to 6/7/01, Me.project_id.value gives 'PR33', which is a project number which exists in the relevant table and has a text data type. Unfortunately, the QryN.RecordsAffected is always 0.)
I was wondering why this wouldn't work... My goal is that when a checkbox is ticked on a form, the current date is recorded in this background table. All the code is in the On Click bit of the checkbox.
Does anyone have any idea, and if so, I would be quite grateful.
Thank you.
Marko.
I was wondering if you could help me. There is a certain query which simply doesn't work when I try it in a module. However, if I transfer it into the query window and press the exclamation mark, it DOES work. Here is the text (Access 97, by the way):
Dim qryN As QueryDef
Dim MyDate As Date
MyDate = Left(Now, 8)
Set qryN = CurrentDb.CreateQueryDef("", "update [q3-2000-01 response] set " & _
"[from (new)]=#" & MyDate & "# where project_id='" & Me.project_id.Value & "'")
MsgBox qryN.SQL
qryN.Execute
MsgBox qryN.RecordsAffected
(I had to get the current date that way because when I use Mydate=Date it gives a null. During execution, Mydate evaluates to 6/7/01, Me.project_id.value gives 'PR33', which is a project number which exists in the relevant table and has a text data type. Unfortunately, the QryN.RecordsAffected is always 0.)
I was wondering why this wouldn't work... My goal is that when a checkbox is ticked on a form, the current date is recorded in this background table. All the code is in the On Click bit of the checkbox.
Does anyone have any idea, and if so, I would be quite grateful.
Thank you.
Marko.