I have this Recordset thing that is working but, being new to this I' thinking that this isn't exactly coded correctly. All of the fields are in the same record so I don't need to move to another record so tried taking out the Loop and MoveNext but it doesn't work. How do I code this correctly?
Thanks
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("SELECT * FROM Customers WHERE Customers.CustomerID = " & Me.TxtCusID & "", dbOpenDynaset)
With rst
Do Until .EOF
Me.TxtBusinessName = !BusinessName
Me.TxtDeeName = !FName & " " & !LName
Me.TxtAddress = !Address
Me.TxtApt = !Apt
Me.TxtCity = !City
Me.TxtState = !State
Me.TxtZipCode = !ZipCode
Me.TxtTel = !Tel
Me.TxtExt = !Ext
Me.TxtFax = !Fax
Me.TxtEMail = !EMail
Me.TxtCreditLimit = !CreditLimit
Me.ChkHouseAccount = !HouseAccount
.MoveNext
Loop
End With
rst.Close
Set rst = Nothing
dbs.Close
Set dbs = Nothing
Thanks
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("SELECT * FROM Customers WHERE Customers.CustomerID = " & Me.TxtCusID & "", dbOpenDynaset)
With rst
Do Until .EOF
Me.TxtBusinessName = !BusinessName
Me.TxtDeeName = !FName & " " & !LName
Me.TxtAddress = !Address
Me.TxtApt = !Apt
Me.TxtCity = !City
Me.TxtState = !State
Me.TxtZipCode = !ZipCode
Me.TxtTel = !Tel
Me.TxtExt = !Ext
Me.TxtFax = !Fax
Me.TxtEMail = !EMail
Me.TxtCreditLimit = !CreditLimit
Me.ChkHouseAccount = !HouseAccount
.MoveNext
Loop
End With
rst.Close
Set rst = Nothing
dbs.Close
Set dbs = Nothing