K
Kate
I'm trying to execute an SQL statement in a macro attached
to a form but get error A RunSQL action requires an
argument consisting of an SQL statement. What is wrong?
Dim strSQL As String
strSQL = "SELECT AVAILABILITY.BookingDate,
AVAILABILITY.Period, AVAILABILITY.Room," _
& "AVAILABILITY.[Day Number], AVAILABILITY.[Booking ID] "
_
& "FROM AVAILABILITY " _
& "WHERE (((AVAILABILITY.BookingDate)=Forms![SINGLE
BOOKING AVAILABILITY]" _
& "!BookingDate) & ((AVAILABILITY.Period)=Forms![SINGLE
BOOKING AVAILABILITY]" _
& "!Combo8) & ((AVAILABILITY.Room)=Forms![SINGLE BOOKING
AVAILABILITY]!Combo10))"
DoCmd.RunSQL strSQL
SQL should look like this:
SELECT AVAILABILITY.BookingDate, AVAILABILITY.Period,
AVAILABILITY.Room, AVAILABILITY.[Day Number], AVAILABILITY.
[Booking ID]
FROM AVAILABILITY
WHERE (((AVAILABILITY.BookingDate)=Forms![SINGLE BOOKING
AVAILABILITY]!BookingDate) And ((AVAILABILITY.Period)
=Forms![SINGLE BOOKING AVAILABILITY]!Combo8) And
((AVAILABILITY.Room)=Forms![SINGLE BOOKING AVAILABILITY]!
Combo10));
to a form but get error A RunSQL action requires an
argument consisting of an SQL statement. What is wrong?
Dim strSQL As String
strSQL = "SELECT AVAILABILITY.BookingDate,
AVAILABILITY.Period, AVAILABILITY.Room," _
& "AVAILABILITY.[Day Number], AVAILABILITY.[Booking ID] "
_
& "FROM AVAILABILITY " _
& "WHERE (((AVAILABILITY.BookingDate)=Forms![SINGLE
BOOKING AVAILABILITY]" _
& "!BookingDate) & ((AVAILABILITY.Period)=Forms![SINGLE
BOOKING AVAILABILITY]" _
& "!Combo8) & ((AVAILABILITY.Room)=Forms![SINGLE BOOKING
AVAILABILITY]!Combo10))"
DoCmd.RunSQL strSQL
SQL should look like this:
SELECT AVAILABILITY.BookingDate, AVAILABILITY.Period,
AVAILABILITY.Room, AVAILABILITY.[Day Number], AVAILABILITY.
[Booking ID]
FROM AVAILABILITY
WHERE (((AVAILABILITY.BookingDate)=Forms![SINGLE BOOKING
AVAILABILITY]!BookingDate) And ((AVAILABILITY.Period)
=Forms![SINGLE BOOKING AVAILABILITY]!Combo8) And
((AVAILABILITY.Room)=Forms![SINGLE BOOKING AVAILABILITY]!
Combo10));