HELP: Populate corresponding userform text fields from access data

  • Thread starter Thread starter sam
  • Start date Start date
S

sam

Hi all,

I have about 7 textbox fields on a userform I created(eg: Emp_Id, Last_name,
First_name, Phone, Street, City, St). All this data is stored in an Access
Database.

Is it possible to populate: Last_name, First_name, Phone, Street, City and
St from access database based on what I input in Emp_Id?

Thanks in Advance
 
There's some sample code here you could adapt:

http://support.microsoft.com/kb/146406

Just comment out this line:

Set Rs = Db.OpenRecordset("Customers")

and un-comment:

'Set Rs = _
'Db.OpenRecordset("SELECT * FROM Customers WHERE Country = 'UK';")

Update the SQL statement to filter based on your Emp_Id textbox. For
example,

"SELECT * FROM Customers WHERE Emp_Id = '" & Emp_Id.Value & "';"

--JP
 
Back
Top