Hi all,
I have worked some with Access direct edit but am new on the DAO Recordsets and unbound forms so trying to learn them. I started a new db today and was able to get populated but starting to put navigation on the form and ran into some errors to debug. I have searched and searched and just cant find a solution. Here is the code:
Option Compare Database
Private Sub Form_Current()
Dim rst As DAO.Recordset
Dim lngCount As Long
Set rst = Me.RecordsetClone
With rst
.MoveLast
.MoveFirst
lngCount = rst.RecordCount
End With
Me.txtRecordNo = "Record " & Me.CurrentRecord & " of " & lngCount
End Sub
Private Sub Form_Load()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("tblCompany")
If rst.RecordCount = 0 Then Exit Sub
txtCompanyID = rst.Fields![CompanyID]
txtCompanyUID = rst.Fields![CompanyUID].Value
txtCompanyName = rst.Fields![CompanyName].Value
txtCreation = rst.Fields![Created].Value
txtModified = rst.Fields![Modified].Value
rst.Close
Set rst = Nothing
Set db = Nothing
End Sub
Now, I get a compile error on form open and highlights the " Set rst = Me.RecordsetClone" (above) and says something about a reference invalid. I have 4 buttons on form I made for MoveFirst, MoveLast, MoveNext, and MovePrev and I cant find any reference to what should go as far as OnClick for the buttons.
Could I please get some help with this as very strange there are no examples that I can get to work on the www?
Thanks
Dave