Re: DoCmd.RunSQL error Help
From: Kate (anonymous_at_discussions.microsoft.com)
Date: 04/29/04
- Next message: CaribSoft: "Re: Saving a CSV file in a memo field"
- Previous message: Sal Rosario: "Re: hidden queries"
- In reply to: fredg: "Re: DoCmd.RunSQL error Help"
- Next in thread: fredg: "Re: DoCmd.RunSQL error Help"
- Reply: fredg: "Re: DoCmd.RunSQL error Help"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 29 Apr 2004 16:15:54 -0700
Trouble with that is I then want to test a field (Booking
ID) in the returned record and I get an error message
Object required. Any thoughts
>-----Original Message-----
>On Thu, 29 Apr 2004 13:33:23 -0700, Kate wrote:
>
>> 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));
>
>RunSQL will only run Action queries.
>
>Create a query using your SQL.
>Then Run the query from your code event.
>DoCmd.OpenQuery "QueryName"
>--
>Fred
>Please only reply to this newsgroup.
>I do not reply to personal email.
>.
>
- Next message: CaribSoft: "Re: Saving a CSV file in a memo field"
- Previous message: Sal Rosario: "Re: hidden queries"
- In reply to: fredg: "Re: DoCmd.RunSQL error Help"
- Next in thread: fredg: "Re: DoCmd.RunSQL error Help"
- Reply: fredg: "Re: DoCmd.RunSQL error Help"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|