I am facing an odd issue, I have a form that reads records from a query.. It loads the first record into the form, without issue.
Code:
Sub FormLoaded()
Dim r As DAO.Recordset
Set r = CurrentDb.OpenRecordset("Results") ' Query we want
Forms("frmmainnew").lbladdUser1bad.Visible = False
Forms("frmmainnew").lbladdUser1bad.Visible = False
'load first Row into form
Forms("frmmainnew").txtaddUser1.Value = r![f13] & " " & r![f14]
Forms("frmmainnew").txtphone1.Value = r![F11]
Forms("frmmainnew").txtRoles.Value = r![F15]
Forms("frmmainnew").Text305.Value = r![F19]
Forms("frmmainnew").Text308.Value = r![F16]
Forms("frmmainnew").Text311.Value = r![F3]
Forms("frmmainnew").Text299.Value = r![F41]
Forms("frmmainnew").Text316.Value = r![F2]
'Forms("frmmainnew").Text311.Value = Replace(r![F3], ",", "") & ";"
'Forms("frmmainnew").Text311.Value = Replace(r![F3], ", ", ";")
' Forms("frmmainnew").Text311.Value = Replace(r![F3], ", ", ";")
r.Close
Set r = Nothing
End Sub
Now I have have 2 buttons at the bottom of the form, one for next record and another for previous record...
Code for next record
Code:
Sub NextRecordbtn()
Dim r As DAO.Recordset
Set r = CurrentDb.OpenRecordset("Results") ' Query we want
r.MoveNext
If r.EOF = True Then
r.MoveFirst
End If
Forms("frmmainnew").lbladdUser1bad.Visible = False
Forms("frmmainnew").lbladdUser1bad.Visible = False
'load first Row into form
Forms("frmmainnew").txtaddUser1.Value = r![f13] & " " & r![f14]
Forms("frmmainnew").txtphone1.Value = r![F11]
Forms("frmmainnew").txtRoles.Value = r![F15]
Forms("frmmainnew").Text305.Value = r![F19]
Forms("frmmainnew").Text308.Value = r![F16]
Forms("frmmainnew").Text311.Value = r![F3]
Forms("frmmainnew").Text299.Value = r![F41]
Forms("frmmainnew").Text316.Value = r![F2]
r.Close
Set r = Nothing
End Sub
The problem I am having is weird... I know that I have 3 records that result in the query named "Results", the next record button will bring the form from record 1, to record 2... however it will not move from the 2nd to the 3rd record...I am sure it is something super simple, but I cannot figure it out for the life of me.