Form links not working

S

Steve

I am having a problem where I have a main form with
buttons on it to link to other forms. In 2003, the links
work, but in 2000/xp, they do not. I have tried both of
the following;

=OpenForms("Print Purchase Order Dialog")

and....

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Print Purchase Order Dialog"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub


When I click it, it doesnt do anything. I have tried
this on 2 different computers and no luck. The format is
access 2000. I think something must be wrong in the
database options or setup, but cant figure it out.

Any help is appreciated.

-Steve
 
A

Allen Browne

The top line of your function declaration is missing, but since it ends with
"End Sub", I'm guessing it begins:
Sub OpenForms()

Replace Sub with Function. It must be a function if you are setting the
OnClick property of your command button like that.
 
G

Guest

Allen,

Thanks for responding. This is the actual code itself in
full.

Private Sub Open_Print_RFQ_Dialog_Click()
On Error GoTo Err_Print_RFQ_Dialog_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Print RFQ Dialog"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Open_Print_RFQ_Dialog_Click:
Exit Sub

Err_Print_RFQ_Dialog_Click:
MsgBox Err.Description
Resume Exit_Open_Print_RFQ_Dialog_Click
End Sub
 
A

Allen Browne

Okay, you are using the event procedure code for the button.

1. Check that the command button's On Click property is set to:
[Event Procedure]
Occassionally this setting is not set, and the code does not run.

2. At the top of the procedure, add:
MsgBox "Okay, Open_Print_RFQ_Dialog_Click executing"
so you know if the procedure is being called.

3. From the Debug menu, choose Compile. In any error is reported, fix, and
repeat until no errors are left.

4. If none of that works, decompile a copy of the database by entering
something like this at the command prompt while Access is not running. It is
all one line, and include the quotes:
"c:\Program Files\Microsoft office\office\msaccess.exe" /decompile
"c:\MyPath\MyDatabase.mdb"
 
G

Guest

Allen,

I have resolved the issue but I want to know if it sounds
wierd to you. In the properties of the form I am
calling, there is a caption value. This was not set, and
when I set it, it works. In 2003 version of access, this
is not set but it works so I assumed it just called the
form name. In XP, it must be set in order to work.

What do you think?

Thanks,

-Steve
-----Original Message-----
Okay, you are using the event procedure code for the button.

1. Check that the command button's On Click property is set to:
[Event Procedure]
Occassionally this setting is not set, and the code does not run.

2. At the top of the procedure, add:
MsgBox "Okay, Open_Print_RFQ_Dialog_Click executing"
so you know if the procedure is being called.

3. From the Debug menu, choose Compile. In any error is reported, fix, and
repeat until no errors are left.

4. If none of that works, decompile a copy of the database by entering
something like this at the command prompt while Access is not running. It is
all one line, and include the quotes:
"c:\Program Files\Microsoft
office\office\msaccess.exe" /decompile
 
A

Allen Browne

Setting the Caption property of the form should not make a difference.

I suspect the form was partially corrupt, so changing any property forced
Access to re-save the object, and so the corruption was removed. If that
guess is correct, you could now remove the Caption again without the problem
recurring.

Anyway, you have it solved.
 

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