Opening individual record by clicking on Datagrid

Using VS6 SP5, Ado , Win2K and Access 2K.

Have a datagrid returning records, wanted to double click on individual record
and it open in its own form for editing purposes. Vinnyd179 provided the code below which works great, however when I change a control's value and
close with Adodc1.Recordset.Update, it doesn't update the record. I assume
the code below only populates the controls and doesnot allow editing...
Can anyone explain to me how to make this form update the current record that is being displayed,( I assume that the record isn't actually opened and that the values that have changed actually need to be inserted back into the Access DB, But I just don't know how to open that exact individual record and append the updates.....

use the double click event of the grid:

' assumes rs is a public recordset

Private Sub DataGrid1_DblClick()
Load Form2
' clear boxes
Form2.Text1 = ""
Form2.Text2 = ""
Form2.Text3 = ""
' populate Textboxes from rs recordset
With rs
    Form2.Text1 = .Fields("Field1").Value
    Form2.Text2 = .Fields("Field2").Value
    Form2.Text3 = .Fields("Field3").Value
End With

Form2.Show

End Sub


Just3082
just3082Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vinnyd79Commented:
Have you tried using the adodc instead of a recordset in the above?

' populate Textboxes
With Adodc1
    Form2.Text1 = .RecordSet.Fields("Field1").Value
    Form2.Text2 = .RecordSet.Fields("Field2").Value
    Form2.Text3 = .RecordSet.Fields("Field3").Value
End With
0
just3082Author Commented:
Yes, This is what I have: However  form2(Assigned_Tickets) opens
and displays the info fine, I can't change any of the data. I can, but it doesn't
send it back to the DB. I've got the controls on the form bound to Adodc1, So
I can't figure out why it isn't working.... Look below the first code for the code in the second form.

Private Sub DataGrid1_DblClick()
Load Assigned_Tickets
Assigned_Tickets.Text1 = Adodc1.Recordset.Fields("Issue").Value & ""
Assigned_Tickets.Text2 = Adodc1.Recordset.Fields("Resolution").Value & ""
Assigned_Tickets.Text3 = Adodc1.Recordset.Fields("Requestor").Value & ""
Assigned_Tickets.Text4 = Adodc1.Recordset.Fields("Time").Value & ""
Assigned_Tickets.Text5 = Adodc1.Recordset.Fields("TicketID").Value & ""
Assigned_Tickets.Text6 = Adodc1.Recordset.Fields("CallTakenBy").Value & ""
Assigned_Tickets.Text7 = Adodc1.Recordset.Fields("Date").Value & ""
Assigned_Tickets.Text8 = Adodc1.Recordset.Fields("ResponseToRequestor").Value & ""
Assigned_Tickets.Text9 = Adodc1.Recordset.Fields("NotesToTech").Value & ""
Assigned_Tickets.Text10 = Adodc1.Recordset.Fields("Extension").Value & ""
Assigned_Tickets.Text11 = Adodc1.Recordset.Fields("Location").Value & ""
Assigned_Tickets.Combo1 = Adodc1.Recordset.Fields("Status").Value & ""
Assigned_Tickets.Combo2 = Adodc1.Recordset.Fields("AssignedTo").Value & ""
Assigned_Tickets.Combo3 = Adodc1.Recordset.Fields("Category").Value & ""
Assigned_Tickets.Combo4 = Adodc1.Recordset.Fields("Escalate").Value & ""
Assigned_Tickets.Combo5 = Adodc1.Recordset.Fields("Department").Value & ""
Assigned_Tickets.Text12 = Adodc1.Recordset.Fields("ComputerName").Value & ""
Assigned_Tickets.Text14 = Adodc1.Recordset.Fields("UserName").Value & ""
Assigned_Tickets.Show
Unload JMHTickets
End Sub


Private Sub Update_Click()
Adodc1.Recordset.Update
Unload Me
JMHTickets.Show
End Sub

Just3082
0
vinnyd79Commented:
>>  I've got the controls on the form bound to Adodc1

If they are bound,then wouldn't they be populated without the need for setting the Text to the record values like this:

Assigned_Tickets.Text1 = Adodc1.Recordset.Fields("Issue").Value & ""

Are you binding the Textboxes on Form2 to the ado control on form1?




0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

just3082Author Commented:
Ok, Everything is working fine now. Apparently all I needed to know to begin with was how to change the record selection in the grid to Row.
This is why before when I click on it, it would open form2, but display
the first record in the DB instead of the record I thought I was clicking on, When in actuality I was clicking on a field, because I didn't have the Row selection enabled. Yes, I feel pretty dumb.....

Thanks Vinnyd179 ....

Just3082
0
just3082Author Commented:
No, I was wrong. When I double click on a record it opens my form2, however it displays
the first record in the set instead of the actual record I double clicked on in the datagrid from form1...

Just3082
0
vinnyd79Commented:
How are the controls on Form2 bound to the ADO Control?Which Form is the ADO control on?


0
just3082Author Commented:
The first form is a simple datagrid with adodc1 to my Ticket database
the second form is full of controls, ADODC1 also to my tickets database, However I have
the adodc1 control disabled on form2 and hidden. I only want the record I clicked on to
be displayed. To answer your question: the controls on form2 are bound through VS6.
I've selected each control and chose adodc1 and the corresponding value in the datafield.

Just3082
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.