Hello All;
I have an unbound form (i.e. record source = blank). It has about 15 text box controls (all reflect "unbound" in design mode). There are 2 controls with control sources of "=[frmDate]" and "=(GetUserName())" (which function fine).
The form opens with blank fields and a blank text box, and a search button is used to kick off the search action (once the desired search term is entered), and the results (record #1) are populated in the respective fields. (works fine)
I use vba SQL code to query the table and populate the form (all works fine).
I use: Debug.Print rs.Fields("AddressLine1") & " " & rs.Fields("AddressLine2") & " " & Me.CurrentRecord; "" and correct info is populated in the Intermediate window (complete with increasing CurrentRecord count number)i.e. search works as desired.
I use: Me.txtRecordDisplay = "Record # " & Me.CurrentRecord & " of " & lngRSCount to display Record# and Total Count. (and this displays correctly also).
The issue is navigating through the recordset once the form is populated.
I use:
Private Sub cmd_MoveNext_Click()
Dim db As DAO.database
Dim rs As DAO.Recordset
Dim RecordCount As Integer
Set db = CurrentDb
'Set rs = Me.Recordset
Set Forms("frm_LogMailEntry_EDIT").Recordset = rs
'Set rs = Me.Recordset.Clone
'If rs.RecordCount + 1 = rs.RecordCount Then
'Me.Cmd_MoveNext.Enabled = False
'Else
DoCmd.GoToRecord acActiveDataObject, , acNext
Debug.Print rs.Fields("AddressLine1") & " " & rs.Fields("AddressLine2") 'to test functionality
'rs.MoveNext
'Me.AddressLine1 = rs![AddressLine1]
'RecordCount = RecordCount + 1
'End If
End Sub
An error 2105, "You can't go to the specified record" occurs on the line "DoCmd.GoToRecord acActiveDataObject, , acNext".
Using "rs.MoveNext" produces an error #91, Object variable or With block variable not set"
Using only the below code on the MoveNext button produces NO error, but record values do not change on the form, i.e. does nothing.
Dim rs As DAO.Recordset
Set rs = Me.Recordset
rs.MoveNext
I have tried several different configurations (hence the rem lines) but none work. I even tried using the "Wizzard" for button creation, which was unsuccessful, as well as turning on Navigation Buttons in the property Sheet and neither attempt worked (although the latter indicated the records were changing, but nothing changed on the form).
Any suggestions would be greatly appreciated.
Thanks...