Passing a RecordSet to Subform

FabbyFil

New member
Local time
Today, 17:07
Joined
Feb 23, 2004
Messages
1
PAssing a RecordSet to a Subform

HI

Can anybody help me I have a recordset built using the following code.

I want to pass this data to a subform and update the display

Code:
Dim rstLine1 As DAO.Recordset
Dim rst_Delete As DAO.Recordset
Dim rst_String As String
Dim dbs_Current As Database
Dim IATA_QryDef As QueryDef

Temp = format(Me.cmb_IATA_SEARCH.Value, "0000000000")
G_IATA = format(Temp, "0000000000")
Temp = format(G_IATA, "0000000000")
Me.IATAno.Value = Temp

Set dbsCurrent = CurrentDb
Set IATA_QryDef = dbsCurrent.CreateQueryDef("")

With IATA_QryDef
.SQL = "SELECT Format([IAT_CPY_NUM] & [IAT_SEQ_NUM],""0000000000"") AS [IATA No], Mid([BSM_DAT],1,10) AS [BSM Rec Date], Mid([BSM_DAT],12,8) AS [BSM Rec Time], DEP_FLI_DAT, " _
             & "DEP_FLI_CPY_ICA_COD AS Carrier, DEP_FLI_NUM AS FlightNo, DEP_DST_COD AS Dest, PAX_NAM AS PName, PAX_SEA AS PSeat, PAX_REF AS Station, ONW_FLI_CPY_ICA_COD_1 AS OCarrier, ONW_FLI_NUM_1 AS OFlightNo, ONW_FLI_DAT_1 AS ODate " _
             & "FROM ORCL_BAGS " _
             & "WHERE Format([IAT_CPY_NUM] & [IAT_SEQ_NUM],""0000000000"") Like '" & Temp & "'"
End With

Set rstLine1 = IATA_QryDef.OpenRecordset

With rstLine1
G_Time = ![BSM REC TIME]
G_Date = ![BSM REC DATE]
G_Flight = ![FlightNo]
.MoveLast
.MoveFirst
End With

[B]Me.frm_IATA_SORT.Form.RecordSource = rstLine1[/B]


The problem is the subform WONT accept the last line and open

Can you Help
 
Last edited by a moderator:
For this statement:
Me.frm_IATA_SORT.Form.RecordSource = rstLine1
the right side needs to be the name of a saved query, or a SQL string. Since you've already got the whole SQL string written out in your code, just try:
IATA_QryDef.SQL
 

Users who are viewing this thread

Back
Top Bottom