Open form criteria set for two records

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.
 
G

Guest

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]
 
S

SAC

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.
 
G

Guest

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.
 
S

SAC

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.
 
S

SAC

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.
 
S

SAC

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.
 

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

Top