Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataCombo and Form

Status
Not open for further replies.

ysommer

Programmer
Feb 26, 2001
45
Hi all,
I have built a from that is based on a db through Data enviroment.
I have on this form a datacombo that has the list customers and I want to syncronize the whole form with the selection.
For example: if I pick John D. all the txtboxs get the values that is for Jhon d.

any idea?

tnx,
Yoel
 
Try something like this:

Public mcnn As ADODB.Connection
Private dbs As ADODB.Recordset

Dim strName as string

Set mcnn = New ADODB.Connection
mcnn.ConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0;" & _
"Data Source = \\locationofdatabase\nameofdb.mdb"
mcnn.Open
Set dbs = New ADODB.Recordset
dbs.CursorType = adOpenKeyset
dbs.LockType = adLockOptimistic
dbs.Source = "SELECT * FROM (nameoftable)" & _
"WHERE * FieldName = '"& strName &"'"
Set dbs.ActiveConnection = mcnn
dbs.Open
with dbs
txtWhatever.text = !fieldname
end with
dbs.close
mcnn.close
----------------
Joe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top