Hi,
I'm having a problem producing a table in a timely fashion and it's an essiential table for a report I am building. I'm pulling records from an ODBC connection and the table I'm pulling from is nearly a million records. I have a very basic code trying to pull the applicable data I need into a table and was wondering if anyone had any tips on what I might be able to try to get through the recordset quicker. My current code is:
Function OpenUnits()
Dim db As Database
Dim qry As DAO.QueryDef
Dim qry1 As DAO.QueryDef
Dim rst As DAO.Recordset
Dim rst1 As DAO.Recordset, rst2 As DAO.Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("WM241BASD_ChCART31")
Set rst2 = db.OpenRecordset("OpenUnits")
rst.MoveFirst
Do Until rst.EOF
If rst("CHSTAT") < 25 Then
rst("CHCASN") = rst2("Carton")
rst("CHPCTL") = rst2("PickTicket")
Else
rst.MoveNext
End If
Loop
End Function
Thanks in advance for any help you can provide.
I'm having a problem producing a table in a timely fashion and it's an essiential table for a report I am building. I'm pulling records from an ODBC connection and the table I'm pulling from is nearly a million records. I have a very basic code trying to pull the applicable data I need into a table and was wondering if anyone had any tips on what I might be able to try to get through the recordset quicker. My current code is:
Function OpenUnits()
Dim db As Database
Dim qry As DAO.QueryDef
Dim qry1 As DAO.QueryDef
Dim rst As DAO.Recordset
Dim rst1 As DAO.Recordset, rst2 As DAO.Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("WM241BASD_ChCART31")
Set rst2 = db.OpenRecordset("OpenUnits")
rst.MoveFirst
Do Until rst.EOF
If rst("CHSTAT") < 25 Then
rst("CHCASN") = rst2("Carton")
rst("CHPCTL") = rst2("PickTicket")
Else
rst.MoveNext
End If
Loop
End Function
Thanks in advance for any help you can provide.