Click to See Complete Forum and Search --> : Sequential Access


I.L. Iterate
April 14th, 2001, 11:17 PM
Here's what I got.
Two forms. The first form has a drop-down menu (Clients) with items "add, edit and delete". these three access a client form with txtboxes to enter their info. When you click the "add" item you get an inputbox for a record number. If you enter a # that already exists you get an error message. Edit and delete also get you a blank client form.
This is what I need.
For the txtboxes to be filled in with the info of existing clients when you click edit or delete and the txtrecord box to have the number that the user enters in the inputbox when they click add.



Chris

Spectre5000
April 18th, 2001, 11:50 AM
Ok. For starters, I am sure you already have your connection set up. And then you have to retrieve your recordset (with all the items you want) based on the client ID entered in the txtRecord box. Then you just need to set the text property of all the other text boxes with the information you retrieved. Kinda looks like this:

dim oConn as New ADODB.Connection
dim RecSet1 as New ADODB.Recordset

'We will just deal with the Edit for now, although the delete will work almost the same way.

With oConn
.ActiveConnection="dsn=Martins" 'or whatever the name is
End With

dim gsquery as String = "Select * from table where clientid = '" & txtClientID.text & "'"

RecSet1.open gsquery

RecSet1.MoveFirst
if RecSet1.EOF then
' Display the appropriate message
Exit sub
end if

txtName.text = RecSet1!Name

And so on, with all the text fields. Now, you will have to make some adjustments, based upon the actual dsn you have set up, and the text field names you are using. Also, this will be inside a particular subroutine. If you want this to happen when you click a button to find the client, it will be in the button_click sub. If you want this to happen when the clientid text field loses focus, this will be in the lostFocus subroutine. does this help? You can email me at clivermore@mcofc.com if you need any additional help or clarification.