StephanieD
New member
- Local time
- Yesterday, 16:53
- Joined
- Aug 30, 2008
- Messages
- 9
I have a very simple module that runs a bunch of SQL queries to convert a database over to a new set of "course codes". The module is simple but long.
There are a little more than 600 lines of code. A few sample lines are shown below. "Most" of the lines run with no problem but some at the end do not run at all, as evidenced by the fact that some codes do not get changed over. But if I take the lines of code at the end and paste them at the top and run it that way, those lines or code run fine.
I tried to combine several modules into a one long module that was several thousand lines long, but Access complained that that it was too long. Fair enough. It is no longer complaining about that, so I assume that 600 lines is not too long. Maybe it is still too long and Access isn't aware that it can't run a module that long??
Any ideas?
Public Sub FUBAR()
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE Course SET [COURSE_ID] = 'JDI039' WHERE [COURSE_ID]= 'CPS1';"
DoCmd.RunSQL "UPDATE Course SET [COURSE_ID] = 'JDI117' WHERE [COURSE_ID]= 'ISL1';"
DoCmd.RunSQL "UPDATE Course SET [COURSE_ID] = 'JDI290' WHERE [COURSE_ID]= 'LS14';"
DoCmd.RunSQL "UPDATE Course SET [COURSE_ID] = 'JDI390' WHERE [COURSE_ID]= 'LS15';"
DoCmd.RunSQL "UPDATE Course SET [COURSE_ID] = 'JDI266' WHERE [COURSE_ID]= 'LS16';"
DoCmd.RunSQL "UPDATE Course SET [COURSE_ID] = 'JDI260' WHERE [COURSE_ID]= 'LS17';"
DoCmd.RunSQL "UPDATE Course SET [COURSE_ID] = 'JDI389' WHERE [COURSE_ID]= 'LS18';"
DoCmd.RunSQL "UPDATE Course SET [COURSE_ID] = 'JDI278' WHERE [COURSE_ID]= 'LS19';"
DoCmd.RunSQL "UPDATE Course SET [COURSE_ID] = 'JDI358' WHERE [COURSE_ID]= 'LS20';"
DoCmd.RunSQL "UPDATE Course SET [COURSE_ID] = 'JDI388' WHERE [COURSE_ID]= 'LS21';"
' 600 more lines of code similar to these....
DoCmd.SetWarnings True
End Sub
There are a little more than 600 lines of code. A few sample lines are shown below. "Most" of the lines run with no problem but some at the end do not run at all, as evidenced by the fact that some codes do not get changed over. But if I take the lines of code at the end and paste them at the top and run it that way, those lines or code run fine.
I tried to combine several modules into a one long module that was several thousand lines long, but Access complained that that it was too long. Fair enough. It is no longer complaining about that, so I assume that 600 lines is not too long. Maybe it is still too long and Access isn't aware that it can't run a module that long??
Any ideas?
Public Sub FUBAR()
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE Course SET [COURSE_ID] = 'JDI039' WHERE [COURSE_ID]= 'CPS1';"
DoCmd.RunSQL "UPDATE Course SET [COURSE_ID] = 'JDI117' WHERE [COURSE_ID]= 'ISL1';"
DoCmd.RunSQL "UPDATE Course SET [COURSE_ID] = 'JDI290' WHERE [COURSE_ID]= 'LS14';"
DoCmd.RunSQL "UPDATE Course SET [COURSE_ID] = 'JDI390' WHERE [COURSE_ID]= 'LS15';"
DoCmd.RunSQL "UPDATE Course SET [COURSE_ID] = 'JDI266' WHERE [COURSE_ID]= 'LS16';"
DoCmd.RunSQL "UPDATE Course SET [COURSE_ID] = 'JDI260' WHERE [COURSE_ID]= 'LS17';"
DoCmd.RunSQL "UPDATE Course SET [COURSE_ID] = 'JDI389' WHERE [COURSE_ID]= 'LS18';"
DoCmd.RunSQL "UPDATE Course SET [COURSE_ID] = 'JDI278' WHERE [COURSE_ID]= 'LS19';"
DoCmd.RunSQL "UPDATE Course SET [COURSE_ID] = 'JDI358' WHERE [COURSE_ID]= 'LS20';"
DoCmd.RunSQL "UPDATE Course SET [COURSE_ID] = 'JDI388' WHERE [COURSE_ID]= 'LS21';"
' 600 more lines of code similar to these....
DoCmd.SetWarnings True
End Sub