Hello,
I'm working at learning VB for Access and I've run into a snag with my current project.
The code below is executed in the ON CURRENT event for a form where the RecordClone retrieves a value from the previous recordset and then enters the number into an unbound textbox. This part works fine.
Where I'm having a problem is limiting the displayed records by date and retaining the values gathered by the RecordClone.
If I remove the "If Rs1.EOF..." Then-Else lines, the code gets trapped in a loop which requires me to CTRL-BREAK.
My other attemps at re-working the SQL code has resulted in Access not able to find any matching data.
Another problem, Should I have created another range of fields in my table to store the "Old Data"?
Maintaining a running tally of the gas pumps (The DB is for a Gas station ) is critical to the success of this DB and I've been racking my brains over the logic for serveral days now.
Thank you,
--Toby Kliem--
---
Dim F As Form: Set F = Me
Dim Rs1 As DAO.Recordset
Dim sq As Variant
Dim BKM As Variant
Dim vRdol As Variant
...
Dim vCvol As Variant
BKM = Me.Bookmark
Set Rs1 = Me.RecordsetClone
Rs1.Bookmark = BKM
Rs1.MovePrevious
If Rs1.BOF = False Then
'Retrieve the running dollar value from Regular Pump
vRdol = Rs1!regdollar
... '6 similar lines removed to save space.
vCvol = Rs1!CylLitre
Rs1.Close
Set Rs1 = Nothing
'Paste Running dollar value into Unbound box.
Me.txtOldRegDollar.Value = vRdol
... '6 similar lines removed to save space.
Me.txtOldCylLitre.Value = vCdol
Else
End If
If Rs1.EOF = False And Rs1.BOF = False Then
'Search tblVolume for Dates that match
' User entered Value.
sq = "SELECT * " & _
"FROM tblVolume " & _
"WHERE VolDate = " &_
"#" & Forms!frmDate.txtGetDate.Value & "#"
F.RecordSource = sq
End If
--- sapere aude: Dare to be wise
I'm working at learning VB for Access and I've run into a snag with my current project.
The code below is executed in the ON CURRENT event for a form where the RecordClone retrieves a value from the previous recordset and then enters the number into an unbound textbox. This part works fine.
Where I'm having a problem is limiting the displayed records by date and retaining the values gathered by the RecordClone.
If I remove the "If Rs1.EOF..." Then-Else lines, the code gets trapped in a loop which requires me to CTRL-BREAK.
My other attemps at re-working the SQL code has resulted in Access not able to find any matching data.
Another problem, Should I have created another range of fields in my table to store the "Old Data"?
Maintaining a running tally of the gas pumps (The DB is for a Gas station ) is critical to the success of this DB and I've been racking my brains over the logic for serveral days now.
Thank you,
--Toby Kliem--
---
Dim F As Form: Set F = Me
Dim Rs1 As DAO.Recordset
Dim sq As Variant
Dim BKM As Variant
Dim vRdol As Variant
...
Dim vCvol As Variant
BKM = Me.Bookmark
Set Rs1 = Me.RecordsetClone
Rs1.Bookmark = BKM
Rs1.MovePrevious
If Rs1.BOF = False Then
'Retrieve the running dollar value from Regular Pump
vRdol = Rs1!regdollar
... '6 similar lines removed to save space.
vCvol = Rs1!CylLitre
Rs1.Close
Set Rs1 = Nothing
'Paste Running dollar value into Unbound box.
Me.txtOldRegDollar.Value = vRdol
... '6 similar lines removed to save space.
Me.txtOldCylLitre.Value = vCdol
Else
End If
If Rs1.EOF = False And Rs1.BOF = False Then
'Search tblVolume for Dates that match
' User entered Value.
sq = "SELECT * " & _
"FROM tblVolume " & _
"WHERE VolDate = " &_
"#" & Forms!frmDate.txtGetDate.Value & "#"
F.RecordSource = sq
End If
--- sapere aude: Dare to be wise