Select row in datasheet automatically

vmon

Registered User.
Local time
Today, 18:40
Joined
Jan 21, 2003
Messages
49
I have a mainform that show a record from a table. On that main form I also have a subform datasheet that shows all of the dates in a column from the same table as the main form, sorted asc. I want to select/highlight the row in the subform datasheet to show where the record on the main form is in the sorted list on the subform. Is this possible?

Thanks,
vmon
 
Use a recordsetclone/bookmark to find the record in the datasheet and then set focus to that record (me.bookmark=recordset.bookmark). Then use the Conditional Format (in A2K or higher) to change the backcolor of the field having focus.

I use a similar technique to hi-light a box slightly larger, surrounding and underneath a complete record in a continuous subform. It works great to indicate record having focus. I also indicate the control having focus by a backcolor change. Controls that can't have their backcolor changed, I change the label color. With this technique, the user always knows what control has focus.
 
Last edited:
This makes sense but I am not sure how to put the syntax. I am using A2k in an ADP with SQL Server backend. I am using ADO. This is what I have right now.

Set rst = Forms!frmMainForm.RecordsetClone
rst.FindFirst "[IdRecNum] = '" & Forms!frmSubForm!IdRecNum & "'"
Forms!frmSubform.Bookmark = rst.Bookmark

Thanks for your reply.
vmon
 
Not quite right, the MainForm is on the right record, search the subform

Set rst = Forms!frmMainForm!frmSubform.Form.RecordsetClone
rst.FindFirst "[IdRecNum] = " & Forms!frmMainForm!IdRecNum
if rs.nomatch then
'error handling
end if
Forms!frmSubform.Bookmark = rst.Bookmark
 

Users who are viewing this thread

Back
Top Bottom