Drilling Down in Datasheet

  • Thread starter Thread starter Deuce Sapp
  • Start date Start date
D

Deuce Sapp

I have a dataform that shows the specifics for a service contract. I have a
subform that shows a datasheet view of the machines that covered by that
contract. I am trying to create an Event if you double click the serial
number in the datasheet subform that will bring up another form to edit the
machine. I have the event working, I am having difficulty creating the
filter (the value of the serial number I double clicked). Here is what I
tried:

Private Sub Serial_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "edit_equip"

stLinkCriteria = "[Serial]=" & Me![Serial]
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub

If I comment out the stLinkCriteria line it works great (just not filtered).


Deuce
 
Allen,

It's a good thing you are so far away or I'd plant a sloppy one on your
cheek. Worked like a champ!

Woo hoo!!!!



Allen Browne said:
You have three commas, where you need two.

If "Serial" is a text-type field (not a Number type field), you need extra
quotes to delimit the text. Try:
stLinkCriteria = "[Serial] = """ & Me![Serial] & """"
DoCmd.OpenForm stDocName, WhereCondition:=stLinkCriteria

Note that the WhereCondition of the OpenForm action only works if the form
is not already open.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to the newsgroup. (Email address has spurious "_SpamTrap")

Deuce Sapp said:
I have a dataform that shows the specifics for a service contract. I
have
a
subform that shows a datasheet view of the machines that covered by that
contract. I am trying to create an Event if you double click the serial
number in the datasheet subform that will bring up another form to edit the
machine. I have the event working, I am having difficulty creating the
filter (the value of the serial number I double clicked). Here is what I
tried:

Private Sub Serial_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "edit_equip"

stLinkCriteria = "[Serial]=" & Me![Serial]
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub

If I comment out the stLinkCriteria line it works great (just not
filtered).
 
Back
Top