Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sub procedure stops at beginning

Status
Not open for further replies.

dropspun

Programmer
May 2, 2001
12
0
0
US
I have a sub that I'm calling from a macro:
Module Name: GeneralFunctions
Procedure Name: SequentialNumber

The program won't execute the sub; it simply stops at the first line of it and pulls up the "General Functions" screen as though I'm debugging. I can click the "Run" menu option and it will execute, but it won't do so automatically. Here's the sub:

Public Sub SequentialNumber()

Dim db As Database
Dim rs As Recordset
Dim lngLoop As Long

Set db = CurrentDb
Set rs = db.OpenRecordset("PeopleSoftOut2")
lngLoop = 1

Do
rs.Edit
rs!FileLine = lngLoop
rs.Update
lngLoop = lngLoop + 1
rs.MoveNext
Loop Until rs.EOF

rs.Close

Set rs = Nothing
Set db = Nothing

End Sub

I'd appreciate any advice!


 
I would test other subs/functions. In addition, consider being more explicit with your code and then compile:
Code:
Dim db As DAO.Database
Dim rs As DAO.Recordset

Duane
Hook'D on Access
MS Access MVP
 
Thanks dhookom. Putting in DAO didn't change anything, but I'm grateful for your time.
 
I'm not sure if this is applicable, but here goes. I have seen something similar in Excel 2007. My code randomly stops in debug mode, I hit continue (debug, continue) and it goes on it's way. The only fix that has worked is, sorry, rebooting your computer. I don't know the underlying issue but it seems to work. I don't reboot my computer as often as I should, but it always fixes that issue. Hope this helps.

Ernest

Be Alert, America needs more lerts
 
Hi Dropspun

2 suggestions.

1) If you happen to have a break point set (Could be a phantom), just open a code window, select clear all breakpoints (Do it twice), then save the code. This seems to solve that issue.

2) If you are calling code from a Macro, functions seem to work better than sub routines, so I would change your sub to a Function.

Just my 2 cents.

Hope This Helps,
Hap...

Access Developer [pc] Access based Accounting Solutions - with free source code
Access Consultants forum
 
Thank you all for your suggestions. Yes, I did try doing a compact and repair (pwise) and rebooting my pc (judgeh59) and clearing the break points (hap007). I did try putting in
DoCmd acCmdClearAllBreaks, but couldn't get it to work -- my fault, it's a little above my skill level (TomCarnahan). I didn't know that other people had had trouble with breakpoints being invisible (if that's what it is). Good to know. Thanks y'all.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top