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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 2450 - Can't find form referred to in code 1

Status
Not open for further replies.
Oct 24, 2002
512
US
I have a command button that, when clicked, is supposed to open the popup form called frmErrorCodes. But I keep getting error #2450. I don't see any typos. Anyone see what I'm doing wrong?

Dim strErrorCode As String
Dim strFormName As String
Dim strLink As String


strFormName = "frmErrorCodes"
strLink = Forms!frmErrorCodes![EOB] = strErrorCode

strErrorCode = InputBox("What error code do you want to look up?", "DRC Claims Error Codes")
DoCmd.OpenForm strFormName, , , strLink


Ann
 
Are you getting the error on this line:
strLink = Forms!frmErrorCodes![EOB] = strErrorCode

or this line:
DoCmd.OpenForm strFormName, , , strLink

?

I could see maybe this working:

strFormName = "frmErrorCodes"
strErrorCode = InputBox("What error code do you want to look up?","DRC Claims Error Codes")
strLink = "[EOB] = '" & strErrorCode & "'"
DoCmd.OpenForm strFormName,,,strLink

-Pete
 
Pete, you're right about it being an apostrophe thing. My form now opens but it opens to the first record rather than to the record with the error code I input. I've played with the placement of apostrophes (which is why it took me so long to get back here) but I can't seem to make it filter correctly. Any further thoughts?

Ann
 
What about this ?
strFormName = "frmErrorCodes"
strErrorCode = InputBox("What error code do you want to look up?", "DRC Claims Error Codes")
DoCmd.OpenForm strFormName, , , "EOB=" & strErrorCode

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I had the quotes in the right place, so you neednt move them. =]

Put a break point on DoCmd.OpenForm and when it pauses there, see what strLink is. I'm not sure what kind of codes you have, but make sure strLink is something like: "[EOB] = '49343'"

-Pete
 
Pete, here's my Locals window after completing the DoCmd.OpenForm line. strLink is still empty

: strErrorCode : "0155" : String
: strFormName : "frmErrorCodes" : String
: strLink : "[EOB] = ''" : String

Ann
 
=] I meant put the break point ON DoCmd.OpenForm, so that you can view the value before it executes. Still though, if there is nothing inside the quotes thats very strange. Did you not enter anything into the Input Box? Do you have the code in the same order i had it in my first post?

-Pete
 
Boy, is my face ever red right now! I had the strLink and strErrorCode lines in reverse order. Thanks so much for your patience and excellent advice.

Ann
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top