Why can't VBA find my form? HELP!

JusticePC

Registered User.
Local time
Today, 19:35
Joined
Mar 1, 2002
Messages
14
Hello All,

I am trying to use the IsLoaded function, and although I specify the name of my form "Termination" when the code runs, it insists that it can't find that form, though it sits, quite plainly, in the form list. Shouldn't "Forms!Termination" refer to the form I have named "Termination?"

Thank you,
Justice
 
That was the syntax I had... Here's the code...

Private Sub Form_Current()
If IsLoaded("Termination") Then
If IsNull([Partner ID]) Then strFilter = "[Partner ID] = 0"

Else: Forms!Termination.Filter = "[Partner ID] = " & [Partner ID]

End If
End Sub

In practice,however,it highlights the Else line and tells me that it can't find that form. Any Ideas?

Thanks
Justice
 
You need to explain what you are trying to do your code doesn't make sense.
If Termination is loaded then apply one filter if not then apply another? If that's the case you need to open the form before you can apply a filter
 
Firstly, thank you for your help.

What I am attempting to do seems as if it should be REALLY simple. I am trying to link two different forms. 1) My main form 2) A related form (though not a subform)

I want, when I click a button on my database, for the secondary form to open... and to have the secondary form open to the corresponding records of the primary form.

Thank you,
Justice
 
Have you looked at Access help on 'Synchronize records between two forms'? It's actually helpful, which can be a little surprising sometimes.

You may also want to use the Expression Builder to make sure you are referring to things by the correct names. It takes a little getting used to but can be handy in some situations.

Good luck,
David R
 
You say your code stops at the else line...
If I am right in analysing your code:

If - your form is loaded - do this

else - if your form is not loaded - do that

Would I be correct saying that the ELSE line cant be carried out as the form is not there to filter?
The form should be open, not just in the database list.

HTH
Dave
 
Hey Guys!

I got it! Thanks a bunch!

As Always,
Justice
 

Users who are viewing this thread

Back
Top Bottom