On-Click Event

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am running this event from a control on a sub-form that refers to another
sub-form. (I have a main form, subform and subform)

The innermost subform is in Datasheet view. This code does what I want, but
it open the sub-form in a separate window. I'd like to modify it so that it
simply either display not found message (no problem there) or displays the
row that matches the search criterion in the datasheet view of the subform,
with the cursor flashing on that row.

Here is my code:

Private Sub Command26_Click()
On Error GoTo Err_Command26_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frm_ppt_search"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command26_Click:
Exit Sub

Err_Command26_Click:
MsgBox Err.Description
Resume Exit_Command26_Click

End Sub

Any help would be great!
 
Dee,
You set the record source of the datasheet view of the subform to a query
that has as it's criteria the record id of the record you want to show.
This can be done by referencing a control containing that id. You can
reference it by right clicking in the query criteria cell of the record id
column and selecting build. Then find the subform and then the control
containing the record id value. Have the event you currently have simple set
the record source of the subform to the query mentioned above.
bob

I am running this event from a control on a sub-form that refers to another
sub-form. (I have a main form, subform and subform)

The innermost subform is in Datasheet view. This code does what I want, but
it open the sub-form in a separate window. I'd like to modify it so that it
simply either display not found message (no problem there) or displays the
row that matches the search criterion in the datasheet view of the subform,
with the cursor flashing on that row.

Here is my code:

Private Sub Command26_Click()
On Error GoTo Err_Command26_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frm_ppt_search"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command26_Click:
Exit Sub

Err_Command26_Click:
MsgBox Err.Description
Resume Exit_Command26_Click

End Sub

Any help would be great!

--
Bob Heifler
My Access Program, Owner
www.myaccessprogram.com
info (At) MyAccessProgram (Dot) com

Message posted via AccessMonster.com
 
Thanks so much for your response. I came up with another solution, but will
try this out over the weekend for future reference.
 
Back
Top