473,395 Members | 1,701 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Help with DAO record schedule EOF File Error

I keep getting an error stating OBJECT VARIABLE OR WITH BLOCK VARIABLE NOT SET.

This error just recently began to happen.
I am exporting some records to excel into a preformatted report.
The records are exported successfully but this error pops up before the export is completed.
When I run the debugger this line gives the error message(OBJECT VARIABLE OR WITH BLOCK VARIABLE NOT SET)

If Not (rsSchedules.EOF = True) Then

Below is my code.
1.
querystring is referring to the following query

Expand|Select|Wrap|Line Numbers
  1. SELECT *
  2. FROM TblOneDayOnly
  3. WHERE (ProgIn =3 OR ProgIn =1) AND (ProgOut =3 OR ProgOut =1);
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdExport_Click()
  2. On Error GoTo Finalstep
  3. Dim querystring As String
  4. Dim dbase As DAO.Database
  5. Dim rsSchedules As DAO.Recordset
  6. Dim tempi As Integer
  7. Dim rptcnt As Integer
  8. rptcnt = 0
  9. If (Me.Optgroup.Value = optScheduleweek.OptionValue Or _
  10. Me.Optgroup.Value = optcharAdhweek.OptionValue) And _
  11. (DateTime.Weekday(txtStartDate.Value, 2) <> 5) Then
  12. MsgBox "The start date is not a Friday, Pls select a friday as start date", vbCritical, "Error"
  13. Exit Sub
  14. End If
  15.  
  16. querystring = GetQueryString
  17. If (Len(Trim(querystring)) > 0) Then
  18. Set dbase = CurrentDb
  19. If (Me.Optgroup.Value = OptMonthly.OptionValue) Then
  20. MsgBox "Exporting monthly report for " & CStr(txtStartDate.Value) & _
  21. " to " & CStr(txtEndDate.Value), vbExclamation, "Export"
  22. tempi = 1
  23. Set rsSchedules = dbase.OpenRecordset(querystring)
  24. If rsSchedules.RecordCount > 0 Then
  25. rsSchedules.MoveLast
  26. rptcnt = rsSchedules.RecordCount
  27.  
  28. End If
  29. If rptcnt = 0 Then GoTo Message
  30. CreateMonthlyReport rsSchedules, GetWeekDay(tempi)
  31.  
  32.  
  33. ElseIf (Me.Optgroup.Value = optScheduleweek.OptionValue) Then
  34.  
  35. MsgBox "Exporting One Day Schedule Flight Activity for " & CStr(txtStartDate.Value) & _
  36. " to " & CStr(txtEndDate.Value), vbExclamation, "Export"
  37. Set rsSchedules = dbase.OpenRecordset(querystring)
  38. If Not (rsSchedules.EOF = True) Then
  39. CreateWeeklyScheduleReport rsSchedules
  40. rptcnt = 1
  41. End If
  42. rsSchedules.Close
  43.  
  44. ElseIf (Me.Optgroup.Value = optcharAdhweek.OptionValue) Then
  45.  
  46. MsgBox "Exporting One Day Charter & Adhoc report for " & CStr(txtStartDate.Value) & _
  47. " to " & CStr(txtEndDate.Value), vbExclamation, "Export"
  48. Set rsSchedules = dbase.OpenRecordset(querystring)
  49. If Not (rsSchedules.EOF = True) Then
  50. CreateWeeklyAdhCharReport rsSchedules
  51. rptcnt = 1
  52. End If
  53. rsSchedules.Close
  54. ElseIf (Me.Optgroup.Value = OptArrivalDate.OptionValue) Then
  55.  
  56. MsgBox "Exporting One Day Daily Flight Activity for " & CStr(txtStartDate.Value)
  57. Set rsSchedules = dbase.OpenRecordset(querystring)
  58. If Not (rsSchedules.EOF = True) Then
  59. CreateDailyReport rsSchedules
  60. rptcnt = 1
  61. End If
  62. rsSchedules.Close
  63.  
  64. End If
  65. Message:
  66. dbase.Close
  67. If Me.Optgroup.Value <> optcharAdhweek.OptionValue Then
  68. If (rptcnt = 0) Then
  69. MsgBox "No Repords Found for Excel Export", vbExclamation, "Export"
  70. Else
  71. MsgBox "Export to excel file(s) completed", vbExclamation, "Export Complete"
  72. End If
  73. End If
  74. Set rsSchedules = Nothing
  75. Set dbase = Nothing
  76. End If
  77.  
  78. Exit Sub
  79. Finalstep:
  80. MsgBox Err.Description, vbCritical, "Error"
  81.  
  82. End Sub
Mar 19 '08 #1
2 1791
Scott Price
1,384 Expert 1GB
You can change:

Expand|Select|Wrap|Line Numbers
  1. If Not(rsSchedules.EOF) Then
There should be absolutely no need to add the = True part.

However, from the way you framed your question, you imply that this was working before, but now is not?

If this is true, I would suspect corruption.

Regards,
Scott
Mar 19 '08 #2
ADezii
8,834 Expert 8TB
I'm not speaking for the other Moderators/Experts, but I can almost guarantee you that few will look at your code unless it is properly Formatted and Code Tagged. There are far too many If...End If and If..ElseIf...End If Statements to make any logical sense of it.
Mar 19 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Mahmood Ahmad | last post by:
Hello, I have written a program that reads three types of records, validates them acording to certain requirements and writes the valid records into a binary file. The invalid records are...
13
by: Mike | last post by:
Normally scheduling a job is a very elementary operation but for some hidden reason I've been unable to schedule a job which runs on a 28 day cycle, even though I have at least 16 other jobs...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
0
by: Dino Vliet | last post by:
Hi folks, I'm new to PostgreSQL and am busy tring to work with it. Of pl/pgsql I know even less and that's the part I have a question on right now. I have this nice example to get me started with...
1
by: dasilva109 | last post by:
Hi guys I am new to C++ and need urgent help with this part of my code for a uni coursework I have to submit by Thursday //ClientData.h #ifndef CLIENTDATA_H #define CLIENTDATA_H #include...
2
by: dasilva109 | last post by:
Hi guys I am new to C++ and need urgent help with this part of my code for a uni coursework I have to submit by Thursday //ClientData.h #ifndef CLIENTDATA_H #define CLIENTDATA_H #include...
3
by: Matthew Warren | last post by:
I have the following piece of code, taken from a bigger module, that even as I was writing I _knew_ there were better ways of doing it, using a parser or somesuch at least, but learning how wasn't...
1
by: ganapathidev | last post by:
I need to store data using set property files, guide me how to store date into the set property files.. i don`t have a much time in my project.. so any one please.. iam developing Schedule...
7
by: dbonin1599 | last post by:
I have the following code, which is going through a FOR loop to run an INSERT statement with a nested SELECT statement. The issue is that I am trying to use the interator in the SQL statement, but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.