Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Popup Form Based on Current Record in Subform

Status
Not open for further replies.
Aug 17, 2000
23
US
Need assistance with the following Click event:

strDocName = "Paper"
strLinkCriteria = "PaperID = Forms!Type!PaperSubform1!PaperID"
DoCmd.OpenForm strDocName, , , strLinkCriteria


When I run the form It prompts with a message box:
"Enter Paramater Value?" When I enter the PaperID
number the record displays in the PopUp window. How
can I achieve this automatically?

Thanks in advance for your help
 
Change this:
strLinkCriteria = "PaperID = Forms!Type!PaperSubform1!PaperID"

to this:

strLinkCriteria = "PaperID = " & Forms!Type!PaperSubform1!PaperID

or THIS if PAPER ID is a text field:

strLinkCriteria = "PaperID = ' " & Forms!Type!PaperSubform1!PaperID & " ' "

Quotes are misplaced, that's all....

Jim How many of you believe in telekinesis? Raise my hand...
Another free Access forum:
More Access stuff at
 
Hello,

Didn't realize anybody responded. I tried both
statments to no avail. When I click the button
an error message prompts the Following:

Microsoft Access can't find the field 'frmPaperSubform'
referred to in your expression.

I have since edited the forms since my last post
the frmPaperSubform is listed correctly. Also, the
PAPERID is AutoNumber.

Here is the current listing in the buttons click event:

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmPaper"
stLinkCriteria = "PaperID = " & Forms!frmType!frmPaperSubform!PAPERID
DoCmd.OpenForm stDocName, , , stLinkCriteria


Thanks for any assistance you provide!

 
It sounds like you need to declare a couple of variables, one for the value of PaperID in the main form and one for the value of PaperID in the subform. Something like:

Dim varMainformPaperID As Long
Dim varSubformPaperID As Long

strDocName = "Paper"
varMainformPaperID = Me.PaperID

Follow that with your DoCmd modified as follows to utilize OpenArgs:

DoCmd.OpenForm strDocName, , , , , , varMainformPaperID

varSubformPaperID = Forms!Type!PaperSubform1!PaperID"

Follow that line up with a find record command like this:

DoCmd.FindRecord varMainformPaperID, , True, , True, , True

You don't need the strLinkCriteria variable. Let me know if it works or not. Good luck! lastout (the game's not over till it's over)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top