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 / Modules / DAO / VBA / November 2006

Tip: Looking for answers? Try searching our database.

Can't get Debug to Work

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dave14117 - 19 Nov 2006 03:30 GMT
Does this work for code behind forms?  Debug - F8 is a no-op for my forms subs
Signature

Thanks,

Dave

Tom Lake - 19 Nov 2006 04:52 GMT
> Does this work for code behind forms?  Debug - F8 is a no-op for my forms
> subs

Did you set a breakpoint in your code?

Tom Lake
Dave14117 - 19 Nov 2006 05:36 GMT
I have tried.  But breakpoint doesn't work either. I know the code is being
executed, but it doesn't stop at the BP.  I feel like I am missing a setting
somewhere, but I don't think there is such a thing
Signature

Thanks,

Dave

> > Does this work for code behind forms?  Debug - F8 is a no-op for my forms
> > subs
>
> Did you set a breakpoint in your code?
>
> Tom Lake
RoyVidar - 19 Nov 2006 10:53 GMT
"Dave14117" <david.mueller@boeing.com> wrote in message
<E80E6866-7225-458D-BD91-8B2A82050F63@microsoft.com>:
> I have tried.  But breakpoint doesn't work either. I know the code is
> being  executed, but it doesn't stop at the BP.  I feel like I am
[quoted text clipped - 6 lines]
>>
>> Tom Lake

If you've played with database security settings, as for instance
the Use Access Special Keys, then often times the AllowBreakIntoCode
property follows. If so, try unchecking the Special Keys thingie, and
see if that helps, else try something like the following

Dim dbs As Database
Set dbs = CurrentDb

with dbs
   .Properties("AllowSpecialKeys") = True
   .Properties("AllowBreakIntoCode") = True
end with

Signature

Roy-Vidar

Dave14117 - 19 Nov 2006 17:06 GMT
Tom - I have not changed Use Access Special Keys -- it's unchecked.  Also not
familiar with the Database type (?).
Signature

Thanks,

Dave

> "Dave14117" <david.mueller@boeing.com> wrote in message
> <E80E6866-7225-458D-BD91-8B2A82050F63@microsoft.com>:
[quoted text clipped - 21 lines]
>     .Properties("AllowBreakIntoCode") = True
> end with
RoyVidar - 19 Nov 2006 17:29 GMT
"Dave14117" <david.mueller@boeing.com> wrote in message
<81E08F90-E54A-4CB0-B707-089233937899@microsoft.com>:
> Tom - I have not changed Use Access Special Keys -- it's unchecked.  
> Also not  familiar with the Database type (?).

Ah -  the other way around - if it's unchecked, then it might be the
problem, try checking it and see if it works. If not, try the code
snippet I pasted. You will probably need to close the db and reopen
it for it to take effect.

Signature

Roy-Vidar

Dave14117 - 19 Nov 2006 18:03 GMT
Ok.  Just checking the Special Keys box didn't change anything for now.  I am
not understanding the snippet.  Is Database a type?
Signature

Thanks,

Dave

> "Dave14117" <david.mueller@boeing.com> wrote in message
> <81E08F90-E54A-4CB0-B707-089233937899@microsoft.com>:
[quoted text clipped - 5 lines]
> snippet I pasted. You will probably need to close the db and reopen
> it for it to take effect.
RoyVidar - 19 Nov 2006 18:08 GMT
"Dave14117" <david.mueller@boeing.com> wrote in message
<97FC43EE-58FB-4788-BD66-BA8132C152F5@microsoft.com>:
> Ok.  Just checking the Special Keys box didn't change anything for
> now.  I am  not understanding the snippet.  Is Database a type?
[quoted text clipped - 8 lines]
>> snippet I pasted. You will probably need to close the db and reopen
>> it for it to take effect.

Yes, it is a datatype. If it isn't recognized, then you probably
haven't set a reference to Microsoft DAO 3.# Object Library (in
Tools | References).

Signature

Roy-Vidar

Dave14117 - 19 Nov 2006 21:00 GMT
Got it.  

So -- now the sub apparently doesn't get entered, which is another mystery.
When there's something amiss in the code, I get the default message for the
event. If I comment out the Database/properties code, the sub is entered.
Signature

Thanks,

Dave

> "Dave14117" <david.mueller@boeing.com> wrote in message
> <97FC43EE-58FB-4788-BD66-BA8132C152F5@microsoft.com>:
[quoted text clipped - 14 lines]
> haven't set a reference to Microsoft DAO 3.# Object Library (in
> Tools | References).
RoyVidar - 19 Nov 2006 21:09 GMT
"Dave14117" <david.mueller@boeing.com> wrote in message
<0C332D4E-332F-4794-9101-A58DFB6FBDB1@microsoft.com>:
> Got it.  
>
[quoted text clipped - 24 lines]
>> haven't set a reference to Microsoft DAO 3.# Object Library (in
>> Tools | References).

The snippet is supposed to only be run once - place it in a standard
module, to alter the settings "to normal". Then when you wish to
"secure" the app again, run it again, then with False (or do a search
in these NGs, as there are lots of solutions/suggestions for setting
properties like this in code.

Private Sub ChangeSomeProps()

   Dim dbs               As DAO.Database
   Set dbs = CurrentDb

   With dbs
       .Properties("AllowSpecialKeys") = True
       .Properties("AllowBreakIntoCode") = True
   End With
   Set dbs = Nothing

End Sub

Signature

Roy-Vidar

Dave14117 - 20 Nov 2006 04:29 GMT
Roy - Settings do not alter problem.

I am a newbie and have a disc of sample solutions. I notice that not only
for my own forms code, but also for the solutions from the book's disc, that
debug does not work for anything in Project Explorer in the Microsoft Office
Access Class Objects folder, where my forms code resides, but does work for
the disc's code that's in the Modules folder.
Signature

Thanks very much,

Dave

> "Dave14117" <david.mueller@boeing.com> wrote in message
> <0C332D4E-332F-4794-9101-A58DFB6FBDB1@microsoft.com>:
[quoted text clipped - 45 lines]
>
> End Sub
RoyVidar - 20 Nov 2006 16:39 GMT
"Dave14117" <david.mueller@boeing.com> wrote in message
<55F089C2-EAF5-4FB0-935C-E07B6B371137@microsoft.com>:
> Roy - Settings do not alter problem.
>
[quoted text clipped - 61 lines]
>>
>> End Sub

I'm perhaps misunderstanding - debug is (or rather, should be) possible
both for form/reports class modules, as with routines in standard
modules. There is one difference, though, form/report code cannot be
initialized from VBE (as far as I know, that is), as you can with
routines residing in standard modules. I'm wondering if this was
possible in a97, but was removed in a2k, but am not sure.

To start debugging/running form/report code, you'll probably need to
trigger it from the form (a button, an event...), but then it should
stop at breakpoints, or at Stop statements, and you should be able to
Step into (F8), step over (Shift+F8)...

In the cases where it does not stop, then I've found that either I or
someone else, has changed some of the properties I've discussed, and
checking the Special Keys thingie, or running such snippet has resolved
the issue.

Signature

Roy-Vidar

Dave14117 - 20 Nov 2006 17:47 GMT
I ran Detect & Repair and now the breakpoints work.  

Your comments helped me understand.  
Signature

Thanks,

Dave

> "Dave14117" <david.mueller@boeing.com> wrote in message
> <55F089C2-EAF5-4FB0-935C-E07B6B371137@microsoft.com>:
[quoted text clipped - 80 lines]
> checking the Special Keys thingie, or running such snippet has resolved
> the issue.
Al Campagna - 19 Nov 2006 13:47 GMT
Dave,
  This is very interesting...  Are you absolutely sure the code is running?  Sorry, but I
know I've been fooled  a few times when my breakpoint didn't trigger.
  Recently, in a complicated DAO loop I used the Stop function to break the loop when a
certain value was encountered...
If GID = 1527 Then
   Stop
>I have tried.  But breakpoint doesn't work either. I know the code is being
> executed, but it doesn't stop at the BP.  I feel like I am missing a setting
[quoted text clipped - 6 lines]
>>
>> Tom Lake
Al Campagna - 19 Nov 2006 13:55 GMT
Dave,
  Sorry about the previous post.  Sent prematurely by mistake...

  This is very interesting...  Are you absolutely sure the code is running?  Sorry to ask
that again, but I
know I've been fooled a few times when a breakpoint didn't trigger.  A trick I use is to
put a Beep in the code.

  Recently, in a complicated and long DAO loop I used the Stop function to break the loop
when a
certain value was encountered...
       If GID = 1527 Then
           Stop
       End If
  Try using a Stop and see if that works.

Signature

hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

>I have tried.  But breakpoint doesn't work either. I know the code is being
> executed, but it doesn't stop at the BP.  I feel like I am missing a setting
[quoted text clipped - 6 lines]
>>
>> Tom Lake
Dave14117 - 19 Nov 2006 16:16 GMT
I used MsgBox to verify code was being executed. (Beep would be better.)
Actually the code even works as far as I got; now that I'm trying to add a
few things, I need to debug. But no-go --  neither breakpoints or normal F8
work.

Here is code. Breakpoint at the OpenForm did not work. Form did open, "2"
did appear as message.

Private Sub Customer_Name_NotInList(NewData As String, _
Response As Integer)
   ' Prompt user to verify they wish to add new value.
   If MsgBox("Value is not in list. Add it?", vbOKCancel, "Add New User?")
= vbOK _
   Then
       MsgBox "1"

       DoCmd.OpenForm "frmCustomers", , , , acFormAdd

       'DoCmd.GoToRecord acActiveDataObject, , acNewRec        
       'frmcustomers.["Last Name First Name"] = NewData
       ' Set Response argument to indicate that data
       ' is being added.
       MsgBox "2"
       Response = acDataErrContinue
   Else
   ' If user chooses Cancel, suppress error message
   ' and undo changes.
      Response = acDataErrContinue
       'ctl.Undo
   End If
Signature

Thanks,

Dave

> Dave,
>    Sorry about the previous post.  Sent prematurely by mistake...
[quoted text clipped - 22 lines]
> >>
> >> Tom Lake
 
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.