Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22
  1. #16
    boywonder381's Avatar
    boywonder381 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Location
    Memphis, TN
    Posts
    28
    I dimmed all variables and still get the same error 3022.

  2. #17
    boywonder381's Avatar
    boywonder381 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Location
    Memphis, TN
    Posts
    28

  3. #18
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Explicitly declaring data type for variables would not be expected to fix the issue. That was just info about programming practice.

    Need info about the business process. Why is this code behind a user login form? Why are you programmatically creating records at login? Why are you using temp tables?

    Why are there 4 ScheduleCourses tables instead of just one?

    The error handler makes debugging difficult. There are lots of errors built into the code that are handled with ResumeNext. This means cannot disable the error handler. Most of these ResumeNext errors seem to be related to a form that is not open but is referenced in code. Better would be to use code that checks if the form is open and sets variables appropriately, instead of repeatedly referencing objects/controls that aren't available. Or set a Boolean variable and use that in subsequent lines as a condition for referencing the form.

    One error that can be immediately fixed is:

    LunchBeg = rsShifts!LunchBeg

    references LunchBeg but the field name is actually LunchBegin. The ResumeNext error handler allowed that error to slip by.

    If you want to avoid the warning popup for table updates, use
    DoCmd.SetWarnings False
    DoCmd.RunSQL ...
    DoCmd.SetWarnings True

    or

    CurrentDb.Execute ...

    strDivide is declared as a string type variable but it is used in division which causes a datatype mismatch error if it is empty. Another runtime error that is passed by the ResumeNext error handler. However, setting this variable as double or integer will still cause an error with the division because can't divide by 0 and if set as variant and allowed to be null this causes an error in another line.

    This line errors because of missing r:
    rsScheduleCourses![Shifts] = strShifts

    rsScheduleCourses1 is not a declared variable.

    Every module should have Option Explicit in the header. This will catch errors like misspelled and undeclared variables.

    I want the debugger to stop on line that triggers error 3022 - not branch to the error handler, so I commented out all the references to the unopened form and disabled the error handler but keep getting these runtime errors that interfere with debugging the issue of interest. Very annoying.

    Run Debug > Compile to catch at least two code errors.

    Clean up code. Test, debug. If you still have issues, post revision.
    Last edited by June7; 08-31-2014 at 06:00 PM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #19
    boywonder381's Avatar
    boywonder381 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Location
    Memphis, TN
    Posts
    28
    OK, Thanks

    The reason for the 4 tblScheduleCourses tables are crazy. I need to delete 2 of them. One suppose to be for the history table and the other so the user can play with the scheduler until it is approved. I will clean the code up and try it again... The temp tables are used so when I divide all table records by 5, I will be able to add records to another table and afterward, it delete that temp table and repeat 5 times. I fix the LunchBeg error... All this does is create the table to view a scheduler. The only user I want to create this scheduler is the admin user. I had to split the code because it had reached it capacity of 64k. Once this is created there are 3 to 4 more processes/reports that will use this table.

  5. #20
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    I hope you got the point that the ResumeNext for all non-specified errors is a bad idea.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #21
    boywonder381's Avatar
    boywonder381 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Location
    Memphis, TN
    Posts
    28
    I know... I was using it while coding and found that it was bypassing crucial data. I just haven't deleted it.

  7. #22
    boywonder381's Avatar
    boywonder381 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Location
    Memphis, TN
    Posts
    28
    I found what was wrong. The Scheduler Course table's StartTime field had to be corrupted for some reason. I went in and started just testing that table and it was giving me the 3022 error when I tried to use the the same time per the StartTime field. I deleted it and add it back in and everything started working good. Thanks everyone for your comments.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. duplicate error
    By msasan1367 in forum Access
    Replies: 3
    Last Post: 04-25-2013, 01:11 PM
  2. Replies: 4
    Last Post: 02-13-2013, 10:46 AM
  3. Replies: 4
    Last Post: 02-13-2012, 08:33 AM
  4. Problem with code to prevent duplicate entries
    By ResearchRN in forum Programming
    Replies: 5
    Last Post: 11-08-2011, 12:12 PM
  5. duplicate problem
    By hokie in forum Access
    Replies: 27
    Last Post: 07-13-2009, 01:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums