Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update ...multiple fields not working

Status
Not open for further replies.

jammerdk

Technical User
Aug 16, 2001
51
DK
Having trouble with the syntax of this Update Query ...could anyone help ???

I'd like the update ...Update the fields AttType and AttMeetTime in the table....

StrSQL = "UPDATE Attend SET Attend.AttType = " & TypeAttend _
& ",Attend.AttMeetTime = " & Me!scrMeetTime & " WHERE (((Attend.AttStudent)=" & Me![scrStudent] & ") AND" _
& "((Attend.AttDate)=#" & Format(TDate, "mm/dd/yy") & "#));"
DoCmd.RunSQL StrSQL
 
Have you verified that your variables and field values (TypeAttend, Me!scrMeetTime, Me![scrStudent], TDate) are populated with legit values? You may also try stepping through (debugging) the code and in the immediate window, check out the value of strSQL after it is assigned. Copy the strSQL value and try running the query directly through Access.
 
have tried that but haven't be able to find the problem....

but when I remove

Attend.AttMeetTime = " & Me!scrMeetTime & "

it works...but then again it's only the AttType that are updated

StrSQL = "UPDATE Attend SET Attend.AttType = " & TypeAttend _
& " WHERE (((Attend.AttStudent)=" & Me![scrStudent] & ") AND" _
& "((Attend.AttDate)=#" & Format(TDate, "mm/dd/yy") & "#));"
DoCmd.RunSQL StrSQL

And i'm tring to get both AttType and AttMeetTime updated...
 
What exactly is TypeAttend?

Have you tried replacing Me![scrStudent] with
Code:
forms("FORM NAME").Controls("scrStudent").Value
?

Hope it helps,

Alex

A wise man once said
"The only thing normal about database guys is their tables".
 
I often find it helpful to Debug.Print troublesome SQL and paste it into the Query Design Window (SQL view).
 
Perhaps this ?
StrSQL = "UPDATE Attend SET Attend.AttType=" & TypeAttend _
& ",Attend.AttMeetTime=#" & Me!scrMeetTime & "#" _
& " WHERE AttStudent=" & Me!scrStudent & " AND " _
& "AttDate=#" & Format(TDate, "mm/dd/yy") & "#;"
DoCmd.RunSQL StrSQL

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top