PhilipEwen
Registered User.
- Local time
- Today, 05:24
- Joined
- Jun 11, 2001
- Messages
- 81
hi, i keep getting type mismatch on the following code whilst trying to set a recordset as a query...
is this possible or have i just got the wrong syntax ??
Dim rst As DAO.Recordset '(DAO.Recordset for 2000)
On Error Resume Next
Set rst = "SELECT ([flights].[departairport], [flights].[arriveairport], [flights].[traveldate], [flights].[duration], [flights].[flightname], [flights].[price], [flights].[flightsresortid]) FROM flights WHERE ((([flights].[traveldate]) Between [Forms]![flights]![txt_date] And [Forms]![flights]![txt_dateto]) And (([flights].[flightsresortid])=[flightsresortid]));"
rst.MoveFirst
If Err <> 0 Then lastdate = DateAdd("d", I, StDate): FillTable: Exit Sub 'No records
Do While Not rst.EOF
rst!departairport = Forms!flights!txt_depart
rst!arriveairport = Forms!flights!txt_arrive
rst!traveldate = DateAdd("d", I + 1, StDate)
rst!duration = Forms!flights!txt_duration
rst!flightname = Forms!flights!txt_flightname
rst!price = Forms!flights!txt_price
rst!flightsresortid = Forms!flights!txt_flightsresortid
rst.Update
rst.MoveNext
I = I + 1
Loop
is this possible or have i just got the wrong syntax ??
Dim rst As DAO.Recordset '(DAO.Recordset for 2000)
On Error Resume Next
Set rst = "SELECT ([flights].[departairport], [flights].[arriveairport], [flights].[traveldate], [flights].[duration], [flights].[flightname], [flights].[price], [flights].[flightsresortid]) FROM flights WHERE ((([flights].[traveldate]) Between [Forms]![flights]![txt_date] And [Forms]![flights]![txt_dateto]) And (([flights].[flightsresortid])=[flightsresortid]));"
rst.MoveFirst
If Err <> 0 Then lastdate = DateAdd("d", I, StDate): FillTable: Exit Sub 'No records
Do While Not rst.EOF
rst!departairport = Forms!flights!txt_depart
rst!arriveairport = Forms!flights!txt_arrive
rst!traveldate = DateAdd("d", I + 1, StDate)
rst!duration = Forms!flights!txt_duration
rst!flightname = Forms!flights!txt_flightname
rst!price = Forms!flights!txt_price
rst!flightsresortid = Forms!flights!txt_flightsresortid
rst.Update
rst.MoveNext
I = I + 1
Loop