|
-
Dec 29th, 1999, 01:38 AM
#1
Thread Starter
Lively Member
I'm working with a DataGrid in VB 6.0. I have displayed the desired data in the grid and have selected a particular record. Now, I want to transfer the value of that record, including all of it's fields, back to my original form which has the same corresponding fields. Can you tell me the names of those constants and how to tranfer? Thanks,
casox
-
Dec 29th, 1999, 01:42 AM
#2
Guru
Possibility:
On the grid_doubleclick event, retrieve the Primary key field in your data control and return it to a global variable. (glngCustID = rs.fields("CustID").value)
Unload the grid form, and query your db for that primary key and display it in your controls on your main form.
data1.recordsource = "Select * from MyTable where CustID = " & glngCustID
data1.refresh
-
Dec 29th, 1999, 01:46 AM
#3
Thread Starter
Lively Member
Thanks so much. Greatly appreciated.
casox
-
Dec 29th, 1999, 02:58 AM
#4
Thread Starter
Lively Member
When I try to assign the global variable the value of rs.Fields("IssueNum").value it gives me an "Object required" error. my exact statement looks like this: glIssueNum = rs.Fields("IssueNum").value I've also set glIssueNum in the form as Public glIssueNum as Integer. Why? Thanks,
casox
-
Dec 29th, 1999, 05:23 AM
#5
Thread Starter
Lively Member
OK, although this solution gives me the value of "a" field, it does not give me the value of the selected field. Is the selected record automatically loaded into the current data control? Or is there another way to obtain the values of the fields?
casox
-
Dec 29th, 1999, 10:10 AM
#6
Guru
When you click on a field in the grid, it will automatically scroll the data control to the record that you have selected on the grid.
You can retrieve the value of the selected field using this code
DataGrid1.Columns(DataGrid1.Col).Text
HTH
Tom
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|