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

Referencing a grid cell

Status
Not open for further replies.

mm0000

IS-IT--Management
May 19, 2002
295
IN
How do i reference a grid cell. If i pass the following to e memory variable it always passes the value of the first row of the column in the grid.

mvar = thisform.grid1.txtbox1.xxx.value

thanks in advance
 

mvar = thisform.grid1.column1.text1.value


Regards

Griff
Keep [Smile]ing
 
That is what I have done - but the value mvar displays is always the first record in the column and does not change when I move the cursor doen the grid.

 
I have to clarify that it mvar displays correct values of the current column but not values of other columns in the same row. For other coulmns it displays the first record in the column.
eg: 3 columns col1 col2 col3
cusrsor in col3
mvar=thisform.grid1.column3.text1.value
mvar1=thisform.grid1.column2.text1.value
mvar2=thisform.grid1.column1.text1.value

mvar is correctly displayed for col3 but not for column 1 and 2




 
have you tried referencing the underlying table/query instead?

mvar = tblMyTable.Myfield
mvar1 = tblMyTable.Myfield1
mvar2 = tblMyTable.Myfield2
Regards

Griff
Keep [Smile]ing
 
Try this:

mvar=thisform.grid1.column3.text1.value
thisform.grid1.column2.text1.setfocus
mvar1=thisform.grid1.column2.text1.value
thisform.grid1.column1.text1.setfocus
mvar2=thisform.grid1.column1.text1.value

Let me know if this helped !

Regards

Agron
 
Are you using the default of textbox for the currentcontrol property of the columun? if you assign another control to the columun, like using a checkbox for boolean. if you have checkbox as currentcontrol then use control name, like combo1.value Attitude is Everything
 
You may need to say for example, "go 4", if you want the value from row 4. There may be some other event that is taking the focus off of your "current" row and putting it back at the top of the cursor.

Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top