G
Guest
Hello Everyone
I'm requesting help on creating a recordset that contains specific records. Once I have the records, I want to look at a specific field in a record and then look at the previous record and grab a value. I then want to go back to the original record and place that value in a field (write it to the record). I have some code I think might work, but I get an error when I run the code. The error tells me that I am missing a parameter-- and for the life of me, I can't figure out what I'm missin
Any help would be greatly appreciated
My code is as follows
Dim dbReadings As DAO.Databas
Dim rstReadings As DAO.Recordse
Dim strSQL As Strin
Dim strSerial As Strin
Dim strEquipment As Strin
Dim PrevNum As Integer, x As Intege
Dim CurNum As Intege
('used just to try different types of OpenRecordset items
strEquipment = Forms![frmEquipmentReadings]![EquipmentID
strSQL = "SELECT * From tblMeterReadings WHERE [EquipmentID] = Forms![frmEquipmentReadings]![EquipmentID]
Set dbReadings = CurrentDb(
Set rstReadings = dbReadings.OpenRecordset("qryTest"
x = DCount("*", "qryTest"
PrevNum =
CurNum =
'strEquipment = Forms![frmEquipmentReadings]![EquipmentID
If x > 0 The
'be sure you're at the last recor
rstReadings.MoveLas
rstReadings.MovePreviou
PrevNum = rstReadings![MeterReadingNew
FindReadingsNew = PrevNu
rstReadings.Edi
rstReadings.Updat
rstReadings.MoveNex
End I
rstReadings.Clos
'get next number & write it to the fiel
FindReadingsNew = PrevNu
Forms![frmEquipmentReadings]![frmMeterReadings SubForm].Form![MeterReadingOld] = FindReadingsNe
I'm requesting help on creating a recordset that contains specific records. Once I have the records, I want to look at a specific field in a record and then look at the previous record and grab a value. I then want to go back to the original record and place that value in a field (write it to the record). I have some code I think might work, but I get an error when I run the code. The error tells me that I am missing a parameter-- and for the life of me, I can't figure out what I'm missin
Any help would be greatly appreciated
My code is as follows
Dim dbReadings As DAO.Databas
Dim rstReadings As DAO.Recordse
Dim strSQL As Strin
Dim strSerial As Strin
Dim strEquipment As Strin
Dim PrevNum As Integer, x As Intege
Dim CurNum As Intege
('used just to try different types of OpenRecordset items
strEquipment = Forms![frmEquipmentReadings]![EquipmentID
strSQL = "SELECT * From tblMeterReadings WHERE [EquipmentID] = Forms![frmEquipmentReadings]![EquipmentID]
Set dbReadings = CurrentDb(
Set rstReadings = dbReadings.OpenRecordset("qryTest"
x = DCount("*", "qryTest"
PrevNum =
CurNum =
'strEquipment = Forms![frmEquipmentReadings]![EquipmentID
If x > 0 The
'be sure you're at the last recor
rstReadings.MoveLas
rstReadings.MovePreviou
PrevNum = rstReadings![MeterReadingNew
FindReadingsNew = PrevNu
rstReadings.Edi
rstReadings.Updat
rstReadings.MoveNex
End I
rstReadings.Clos
'get next number & write it to the fiel
FindReadingsNew = PrevNu
Forms![frmEquipmentReadings]![frmMeterReadings SubForm].Form![MeterReadingOld] = FindReadingsNe