Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / April 2006

Tip: Looking for answers? Try searching our database.

Sub proecedure wont run

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Matthew Pearce - 12 Nov 2005 08:03 GMT
Hi there

I am comfortable with Excel VBA, but have a problem running my first sub
procedure in Access. I am following a tutorial book, the sub is very simple,
but when I position the cursor inside the sub and click on Run I get a prompt
for macro name as if the VBE does not recognise the sub as capable of being
run ...

Public Sub OpenClientForm()
' Open the Client form
DoCmd.OpenForm "Clients"
Debug.Print 'The form is open'
End Sub

Is this an installation error, or a security problem or something?  
I am running MS-Access 2002.

Any suggestions gratefully received!

Matthew Pearce - 12 Nov 2005 08:29 GMT
Problem sorted - the sub procedure was contained in the code section of a
form and not in a general module. Once the sub had been moved to a module, it
worked okay

> Hi there
>
[quoted text clipped - 15 lines]
> Any suggestions gratefully received!
>  
Vincent Johns - 12 Nov 2005 15:50 GMT
> Problem sorted - the sub procedure was contained in the code section of a
> form and not in a general module. Once the sub had been moved to a module, it
> worked okay

If you wish to execute a procedure directly from the Database Window,
you can define (in your Module) a public function which calls it, and
then define a Macro that includes a RunCode action to execute your
function.  That can be a convenient way to debug parts of your code.

  -- Vincent Johns <vjohns@alumni.caltech.edu>
  Please feel free to quote anything I say here.
Paul Richardson - 29 Apr 2006 19:18 GMT
I have a similar problem, but different symptoms.  I can launch my app from
the database window by double-clicking on the Main form icon, but none of my
breakpoints in the code window hit.  If I select the Main() sub in my modMain
(which loads and launches the frmMain) in the VB Editor Code Window and
select Run from the Run menu, nothing happens.  No form launches, no error
messages, nothing.  If I don't have a sub or anything selected and click the
Run icon in the VB Editor, it asks for a macro to run.  

I KNOW that I am being incredibly obtuse about something here, but I just
can't seem to figure out how to get into the debugger, or to start the app in
a "debug" mode.

This is Access 2002 from Office XP on a Dell Inspiron 1100 running Windows
XP SP2.  All OS and Office updates are applied.  TIA.

Paul

> > Problem sorted - the sub procedure was contained in the code section of a
> > form and not in a general module. Once the sub had been moved to a module, it
[quoted text clipped - 7 lines]
>    -- Vincent Johns <vjohns@alumni.caltech.edu>
>    Please feel free to quote anything I say here.
Paul Richardson - 29 Apr 2006 19:45 GMT
Never mind.  I found the answer in another newsgroup!

> I have a similar problem, but different symptoms.  I can launch my app from
> the database window by double-clicking on the Main form icon, but none of my
[quoted text clipped - 24 lines]
> >    -- Vincent Johns <vjohns@alumni.caltech.edu>
> >    Please feel free to quote anything I say here.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.