franksirvent
Programmer
Hi
I am trying to load a number of records via a Query (as per below) on the FORM_ONLOAD() so it is loaded in memory and can be used at anytime while the form is open (so it doesn't have to constantly load the data over and over again so it is faster...)
The form calls another SUB which goes through each record on the 'sqlline2' (query) below and then quickly finds the data it needs to do a number of calculations.
This is the sub it runs to go through the records...
------------------------------------------------------
private sub gothroughtherecords()
rst2.MoveFirst
Do Until rst2.EOF
If firstpart = rst![Direction] then [txt20] = rst2![20]
rst2.MoveNext
Loop
end sub
------------------------------------------------------
But it doesn't work.
Obviously I am doing something wrong...
Anyone can help me?
thanks
THIS IS HOW I LOAD THE DATA ON THE FORM_ONLOAD
------------------------------------------------------
Public Sub loadbafdata()
sqlline2 = "SELECT g.*, g.ChargeDescription "
sqlline2 = sqlline2 & " FROM [BAF Rates1] as g "
sqlline2 = sqlline2 & " WHERE ((([ChargeDescription])='BAF'));"
Set dbs = CurrentDb()
Set rst2 = dbs.OpenRecordset(sqlline2)
rst2.MoveLast
nor = rst2.RecordCount
End Sub
------------------------------------------------------
I am trying to load a number of records via a Query (as per below) on the FORM_ONLOAD() so it is loaded in memory and can be used at anytime while the form is open (so it doesn't have to constantly load the data over and over again so it is faster...)
The form calls another SUB which goes through each record on the 'sqlline2' (query) below and then quickly finds the data it needs to do a number of calculations.
This is the sub it runs to go through the records...
------------------------------------------------------
private sub gothroughtherecords()
rst2.MoveFirst
Do Until rst2.EOF
If firstpart = rst![Direction] then [txt20] = rst2![20]
rst2.MoveNext
Loop
end sub
------------------------------------------------------
But it doesn't work.
Obviously I am doing something wrong...
Anyone can help me?
thanks
THIS IS HOW I LOAD THE DATA ON THE FORM_ONLOAD
------------------------------------------------------
Public Sub loadbafdata()
sqlline2 = "SELECT g.*, g.ChargeDescription "
sqlline2 = sqlline2 & " FROM [BAF Rates1] as g "
sqlline2 = sqlline2 & " WHERE ((([ChargeDescription])='BAF'));"
Set dbs = CurrentDb()
Set rst2 = dbs.OpenRecordset(sqlline2)
rst2.MoveLast
nor = rst2.RecordCount
End Sub
------------------------------------------------------