Populating Unbound Fields

D

DS

Is there a way to populate Unbound Textboxes on an Unbound Form based on
a CustomerID without using a number of DLookUps?
These are the fields
Me.TxtBusinessName
Me.TxtDeeName
Me.TxtAddress
Me.TxtApt
Me.TxtCity
Me.TxtState
Me.TxtZipCode
Me.TxtTel
Me.TxtExt
Me.TxtFax
Me.TxtEMail
Me.TxtCreditLimit
Me.ChkHouseAccount
They are all from one table called Customers.
Thanks
DS
 
D

DS

DS said:
Is there a way to populate Unbound Textboxes on an Unbound Form based on
a CustomerID without using a number of DLookUps?
These are the fields
Me.TxtBusinessName
Me.TxtDeeName
Me.TxtAddress
Me.TxtApt
Me.TxtCity
Me.TxtState
Me.TxtZipCode
Me.TxtTel
Me.TxtExt
Me.TxtFax
Me.TxtEMail
Me.TxtCreditLimit
Me.ChkHouseAccount
They are all from one table called Customers.
Thanks
DS
Ok This almost works...
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

The problem is TxtDeeName which combines 2 fields...it works until I try
to add those 2 fields together.
Thanks
DS
 
D

DS

DS wrote:
This works. But do I have to loop through this? Do I need the .Move
Next? etc....
Thnaks
DS

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
 
D

DS

Duane said:
Me.TxtDeeName = !FName& " " &!LName
Thanks Duane.
Hey Duane do I need to use DAO on the recordset?
Also is this right with the loop and move next or is this unneccasary?
Thanks
DS
 
Top