Double Click Event in Subform

  • Thread starter Thread starter That Crazy Hockey Dood
  • Start date Start date
T

That Crazy Hockey Dood

Good Day Everyone..

I have looked for an answer to my issue but have not been successful thus far.

I have a main form. The main form contains Subform 'A' and Subform 'B'.
Please note that Subform 'B' resides on a tab control. Subform 'A' is a
quick glance of a customer (account # & account name). Subform 'B' has all
of the detailed contact information for the account (contact name, contact #,
etc.). I already have a text box that allows the user to key in the account
# or name of the account. Upon hitting search requery runs that fields the
data on subform 'B'.

I would like to double click an account in Subform 'A' and have the
information for the selected customer show up on Subform 'B'. I have done
something like this previously but I opened a form off of a double-click
event.

Can anyone assist me on this?

Thanks,
Jim
 
Hi,
here is what I think you are trying to achieve.
When user double clicks in subform A, you grab the key ID field and use this
field to find the related data for and put this related data into subform B
as the record source for subform B. Does this make sense?

Jeanette Cunningham
 
That is correct.

I use an 'ID' field from subform 'A' that puts the related data in subform
'B'. You are on it.

Do you have a possibility for me?
--
"Baliff. Whack him in the pee-pee!"
"How come his is so much bigger then yours?"
"I am not even suppose to be here today!"


Jeanette Cunningham said:
Hi,
here is what I think you are trying to achieve.
When user double clicks in subform A, you grab the key ID field and use this
field to find the related data for and put this related data into subform B
as the record source for subform B. Does this make sense?

Jeanette Cunningham
 
What code do you currently have on the double click event for subformA?

Jeanette Cunningham


That Crazy Hockey Dood said:
That is correct.

I use an 'ID' field from subform 'A' that puts the related data in subform
'B'. You are on it.

Do you have a possibility for me?
 
None. The only event I have code written for that communicates with subform
'B' is a command button which runs a requery based upon the information in
the textbox next to it.
 
Hi,
Something like this

Private Sub Form_DblClick(Cancel As Integer)
Dim strSQL as String

strSQL = "SELECT tblName.Field1, tblName.Field2 FROM tblName WHERE
tblName.PrimaryKeyField = " & Me.[Name of subform
control].Form.txtPrimaryKeyField & ""

Me.[Name of subform control].Form.RecordSourec = strSQL

End Sub

Jeanette Cunningham
 
Oops,
I wrote the code as if it was being called from the main form,
but it is being called from subformA
that should be

Private Sub Form_DblClick(Cancel As Integer)
Dim strSQL as String

strSQL = "SELECT tblName.Field1, tblName.Field2 FROM tblName WHERE
tblName.PrimaryKeyField = " & Me.txtPrimaryKeyField & ""

Parent.[Name of subform control].Form.RecordSourec = strSQL

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top