Help with SQL syntax

A

Alan Fisher

Im having problems with the following SQL statement. It
works fine without "HoursFlown = " & sngActHours. I need
to SET both HoursScheduled and HoursFlown but I don't know
how to do it. I tried using a ";" between the two but it
still errors. I know it's just a matter of syntax but
can't seem to get it working. Thanks for your help.


qdf.SQL = "UPDATE WingSchedule SET HoursScheduled = " _
& sngSchedHours _& "HoursFlown = " & sngActHours _
& " WHERE AirSpace = '" & strCurMoa & "'" _
& " And " & " Date = #" & datCurDay & "#" _
& " AND " & "Wing ='" & strCurWing & "'"
qdf.Execute
 
A

Alan Fisher

-----Original Message-----
Im having problems with the following SQL statement. It
works fine without "HoursFlown = " & sngActHours. I need
to SET both HoursScheduled and HoursFlown but I don't know
how to do it. I tried using a ";" between the two but it
still errors. I know it's just a matter of syntax but
can't seem to get it working. Thanks for your help.


qdf.SQL = "UPDATE WingSchedule SET HoursScheduled = " _
& sngSchedHours _& "HoursFlown = " & sngActHours _
& " WHERE AirSpace = '" & strCurMoa & "'" _
& " And " & " Date = #" & datCurDay & "#" _
& " AND " & "Wing ='" & strCurWing & "'"
qdf.Execute
.
I figured it out myself. I needed a comma to separate the
two not a semi-colon.
 
L

losmac

qdf.SQL = "UPDATE WingSchedule SET HoursScheduled = " _
& sngSchedHours _ & " HoursFlown = " & sngActHours _
& " WHERE (((AirSpace) = '" & strCurMoa & "')" _
& " And " & " ((Date) = #" & datCurDay & "#)" _
& " AND " & "((Wing) ='" & strCurWing & "'));"


I insert between sngSchedHours and HoursFlown a space " "
I insert "()" and ";"
Good practice is to repeat the name of table before each
field. Create one query in query wizard and take a look
for sql statement.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top