Open form criteria set for two records

  • Thread starter Thread starter SAC
  • Start date Start date
S

SAC

I'm trying to click a button on a form and open another form. Based on the
criteria, the 2nd form should show 1 of 2 records.

Right now I have:

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmTWDHPH"

stLinkCriteria = "[PHORD]=" & Forms![frmLookup]![frmLookup
subform]![TXTXTPO]

DoCmd.OpenForm stDocName, , , stLinkCriteria

This should show 2 records, but when I run this I get the error: "The
OpenForm action was cancelled."

What can I do to get this to run?

Thanks.
 
Looks like you are trying to use a field from a subform, in which case your
criteria should be
stLinkCriteria = "[PHORD]=" &
Forms![frmLookup]![frmLookupsubform].form![TXTXTPO]
 
I changed it to this and still get the same error:

Thanks for your help.

I changed it to this and still get the same error:

stDocName = "frmTWDHPH"

stLinkCriteria = "[XCPO]=" & Forms![frmLookup]![frmLookup
subform].Form![txtXCPO]

DoCmd.OpenForm stDocName, , , stLinkCriteria

schasteen said:
Looks like you are trying to use a field from a subform, in which case your
criteria should be
stLinkCriteria = "[PHORD]=" &
Forms![frmLookup]![frmLookupsubform].form![TXTXTPO]


SAC said:
I'm trying to click a button on a form and open another form. Based on the
criteria, the 2nd form should show 1 of 2 records.

Right now I have:

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmTWDHPH"

stLinkCriteria = "[PHORD]=" & Forms![frmLookup]![frmLookup
subform]![TXTXTPO]

DoCmd.OpenForm stDocName, , , stLinkCriteria

This should show 2 records, but when I run this I get the error: "The
OpenForm action was cancelled."

What can I do to get this to run?

Thanks.
 
Is [XCPO] text? if so use
stLinkCriteria = "[XCPO]= '" &
Forms![frmLookup]![frmLookupsubform].Form![txtXCPO] &"'"

SAC said:
I changed it to this and still get the same error:

Thanks for your help.

I changed it to this and still get the same error:

stDocName = "frmTWDHPH"

stLinkCriteria = "[XCPO]=" & Forms![frmLookup]![frmLookup
subform].Form![txtXCPO]

DoCmd.OpenForm stDocName, , , stLinkCriteria

schasteen said:
Looks like you are trying to use a field from a subform, in which case your
criteria should be
stLinkCriteria = "[PHORD]=" &
Forms![frmLookup]![frmLookupsubform].form![TXTXTPO]


SAC said:
I'm trying to click a button on a form and open another form. Based on the
criteria, the 2nd form should show 1 of 2 records.

Right now I have:

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmTWDHPH"

stLinkCriteria = "[PHORD]=" & Forms![frmLookup]![frmLookup
subform]![TXTXTPO]

DoCmd.OpenForm stDocName, , , stLinkCriteria

This should show 2 records, but when I run this I get the error: "The
OpenForm action was cancelled."

What can I do to get this to run?

Thanks.
 
AWESOME!! Thanks!

I knew better, but need another pair of eyes!

Thanks a bunch!!!

schasteen said:
Is [XCPO] text? if so use
stLinkCriteria = "[XCPO]= '" &
Forms![frmLookup]![frmLookupsubform].Form![txtXCPO] &"'"

SAC said:
I changed it to this and still get the same error:

Thanks for your help.

I changed it to this and still get the same error:

stDocName = "frmTWDHPH"

stLinkCriteria = "[XCPO]=" & Forms![frmLookup]![frmLookup
subform].Form![txtXCPO]

DoCmd.OpenForm stDocName, , , stLinkCriteria

schasteen said:
Looks like you are trying to use a field from a subform, in which case your
criteria should be
stLinkCriteria = "[PHORD]=" &
Forms![frmLookup]![frmLookupsubform].form![TXTXTPO]


:

I'm trying to click a button on a form and open another form. Based
on
the
criteria, the 2nd form should show 1 of 2 records.

Right now I have:

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmTWDHPH"

stLinkCriteria = "[PHORD]=" & Forms![frmLookup]![frmLookup
subform]![TXTXTPO]

DoCmd.OpenForm stDocName, , , stLinkCriteria

This should show 2 records, but when I run this I get the error: "The
OpenForm action was cancelled."

What can I do to get this to run?

Thanks.
 
Excellent! Thanks!
schasteen said:
Is [XCPO] text? if so use
stLinkCriteria = "[XCPO]= '" &
Forms![frmLookup]![frmLookupsubform].Form![txtXCPO] &"'"

SAC said:
I changed it to this and still get the same error:

Thanks for your help.

I changed it to this and still get the same error:

stDocName = "frmTWDHPH"

stLinkCriteria = "[XCPO]=" & Forms![frmLookup]![frmLookup
subform].Form![txtXCPO]

DoCmd.OpenForm stDocName, , , stLinkCriteria

schasteen said:
Looks like you are trying to use a field from a subform, in which case your
criteria should be
stLinkCriteria = "[PHORD]=" &
Forms![frmLookup]![frmLookupsubform].form![TXTXTPO]


:

I'm trying to click a button on a form and open another form. Based
on
the
criteria, the 2nd form should show 1 of 2 records.

Right now I have:

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmTWDHPH"

stLinkCriteria = "[PHORD]=" & Forms![frmLookup]![frmLookup
subform]![TXTXTPO]

DoCmd.OpenForm stDocName, , , stLinkCriteria

This should show 2 records, but when I run this I get the error: "The
OpenForm action was cancelled."

What can I do to get this to run?

Thanks.
 
Got it! Thanks!
schasteen said:
Is [XCPO] text? if so use
stLinkCriteria = "[XCPO]= '" &
Forms![frmLookup]![frmLookupsubform].Form![txtXCPO] &"'"

SAC said:
I changed it to this and still get the same error:

Thanks for your help.

I changed it to this and still get the same error:

stDocName = "frmTWDHPH"

stLinkCriteria = "[XCPO]=" & Forms![frmLookup]![frmLookup
subform].Form![txtXCPO]

DoCmd.OpenForm stDocName, , , stLinkCriteria

schasteen said:
Looks like you are trying to use a field from a subform, in which case your
criteria should be
stLinkCriteria = "[PHORD]=" &
Forms![frmLookup]![frmLookupsubform].form![TXTXTPO]


:

I'm trying to click a button on a form and open another form. Based
on
the
criteria, the 2nd form should show 1 of 2 records.

Right now I have:

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmTWDHPH"

stLinkCriteria = "[PHORD]=" & Forms![frmLookup]![frmLookup
subform]![TXTXTPO]

DoCmd.OpenForm stDocName, , , stLinkCriteria

This should show 2 records, but when I run this I get the error: "The
OpenForm action was cancelled."

What can I do to get this to run?

Thanks.
 
Back
Top