You might want to do this through ADO ... but it should be
similiar to DAO ... just different syntax.
Assuming that the values you want can be derived from your
textbox value ... which is already on the form.
I would create a subprocedure for the after update event
on the "textboxvalue" in VB
The subprocedure would look something like this:
Dim db As Database
Dim rec As Recordset
Dim strQry as String
strQry = "YourQry" ' Create qry
Set db = CurrentDb() ' set db to Current Database
Set rec = db.OpenRecordset( strQry) ' Open a recordset
based on the defined qry
Me!field= rec!field ' Set the field values
Instead of creating a String you COULD just put in the Qry
name ie: Set rec = db.OpenRecordset( QryName)
But because your "textboxvalue" is probably going to
change ... I would set the String equal to:
"SELECT ename, sal, desig FROM emp WHERE empno = " & forms!
textboxvalue
The "&" is a way to concatenate strings
(It took me 3
hours to figure the "&" out
)
I hope that helps... and if anyone thinks my approach
isn't the best one ... please feel free to correct
-Mercy