Opening specific data from using onclick

swarv

Registered User.
Local time
Today, 06:23
Joined
Dec 2, 2008
Messages
196
I have a subform in datasheet view and when i click on a box (record) i can use the onclick function to load another form. But how do I get it so it brings over just that record data that i just clicked on on the datasheet on to the new form?

Thanks
 
you can send the value of the clicked field as an open arguments value,
or open the form filtered by that value.
Private Sub Form_Open(Cancel As Integer)
If Not IsNull(Me.OpenArgs) Then
Dim strEmployeeName As String
strEmployeeName = Me.OpenArgs

the docmd.formopen command allows you to send both the openargs value and a filter string if needed.
DoCmd.OpenForm "", acNormal, "id = " & 2, , , , openargumentvalue

once you have the identifying data, you can load or find the record you need

there are other ways, but this works well for subforms
 
hi
many thanks for this. It has helped. I am having a problem with the following where clause. it is not picking up the approveID.

SELECT qry_approve.ID, qry_approve.name, qry_approve.start_date
FROM qry_approve
WHERE (((qry_approve.ID)=[forms]![frm_homepage].[approveID]));

approveID is in qry_approve which is in a subform in a tab control in frm_homepage.

Any ideas?

Thanks
 
you have to also reference the subform.
Forms![frm_homepage]![subformname].[approvideID]
 

Users who are viewing this thread

Back
Top Bottom