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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Click Grid cell and open cell data in new window..... 2

Status
Not open for further replies.

barant

Programmer
Aug 6, 2003
12
US
Hi all, my first post here. I have a database app with 3 fields in my table: ID, name , and problem. The app has a grid that loads all records into it, but I want to be able to click a certain record and have that record open on a new form in a text box for each field, and then be able to change the text, and save. I have the grid loading, but cant figure out how to get the data from whatever cell the user clicks into the new form. Please Help.
Thank You
 
Hey, this is something I did with an MSHFlexGrid. Maybe you can adapt the methods to your needs.

'on the form with the grid
Public myField1
Public myField2
Public myField3
Public myField4

Private Sub MSHFlexGrid1_DblClick()

'myRow = MSHFlexGrid1.Row

MSHFlexGrid1.Col = 0
myField1 = MSHFlexGrid1.Text
MSHFlexGrid1.Col = 1
myField2 = MSHFlexGrid1.Text
MSHFlexGrid1.Col = 2
myField3 = MSHFlexGrid1.Text
MSHFlexGrid1.Col = 3
myField4 = MSHFlexGrid1.Text

newForm.Show
End Sub

'in the other newForm
Private Sub Form_Load()
Text1.Text = frmDisplay.myField1
Text2.Text = frmDisplay.myField2
Text3.Text = frmDisplay.myField3
Text4.Text = frmDisplay.myField4
End Sub
 
pdbowler,
Thank you, thank you, thank you. I have been searching in vain for 2 days solid for the way to retrieve values from a data grid and put them in a text box on another form. Your code worked perfect. I am very grateful.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top