Custom parameter dialog boxes

E

Ed

I'm trying to make a customized dialog box for a parameter query. I
can't get the command buttons to work. Here's the code I'm using:

Private Sub cmdCancel_Click()
DoCmd.Close acForm, "frmLocationSelector"
End Sub

Private Sub cmdOK_Click()
DoCmd.OpenQuery "qryPhysicalCountEntryTool", acViewNormal, acEdit
DoCmd.Close acForm, "frmLocationSelector"
End Sub

When I click either button, an error saying "Invalid procedure call or
argument." What am I doing wrong?

Thanks for your help.
 
E

Ed

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The only thing I can think of is the form name is mis-spelled.  If the
command button is closing its own form then you can use Me.Name instead
of the actual name of the form.

The OpenQuery parameters are not needed since they are the default
parameters.

The query that you are opening may be trying to call a procedure or has
a mis-spelled column name.  Try running it from the Query Design window
to see if it can run OK outside of VBA.

HTH,
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup.  I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBScwF6IechKqOuFEgEQLSwgCfeYX2PvKO+ijLJefWPDZv/1R/NxoAoOpb
i3UWxXGehBtsV1U3wTM9tgdj
=9NIi
-----END PGP SIGNATURE-----

I've double checked the spelling of all the items and everything. But
here's something interesting- I can't use a switchboard either. When I
run the switchboard, it gives me the same error. I have a theory that
the over protective IT guy at my work has blocked VBA code from
running. I already had a hell of a time convincing him to install
Access on my terminal. Is it possible that he did this? If he did, is
there any real reason for him to have done it?
 
E

Ed

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

For the Switchboard form - you can put a BreakPoint at the Form_Open()
subroutine or the HandleButtonClick function, depending on where the
error occurs, and step thru the code to see which command is causing the
error.  This will help you determine if it is a References problem, and,
if so, which Reference library is malfunctioning/missing.

I don't believe VBA can be blocked if you have Access installed.  You
might want to make sure that the VBA item is checked in the VBA module:
menu Tools > References, item "Visual Basic for Applications."  It also
might be one of the other References is MISSING.  If there is a MISSING
Reference, you can use the Browse button to navigate through the
system/program files to find the appropriate .dll or object library
file.  The file names are at the bottom of the Reference dialog box.

There's no good reason to disable VBA.  The network can be controlled by
setting permissions on the various folders/files.  VBA can wreck havoc
on the file system if these permissions are left wide open.  But, there
are other means to wreck havoc on the file system without using VBA!

HTH,
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup.  I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSc11CYechKqOuFEgEQJw/QCfRvc602rT91AJkGgXkFHFL1oDKEUAoJiA
xiPZZEKgrgO6Onq8cznO3DNO
=dQ4c
-----END PGP SIGNATURE------ Hide quoted text -

- Show quoted text -

I can't get into the References menu. It's greyed out. When the error
message comes up with the switchboard, the line "Private Sub Form_Open
(Cancel As Integer)" is highlighted. This is my first time getting
into vba so I don't know if that's the line that's causing the error
or what. With the dialog boxes the same line was highlighted on errors.
 

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