473,666 Members | 2,302 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with DAO record schedule EOF File Error

6 New Member
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.EO F = 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 1807
Scott Price
1,384 Recognized Expert Top Contributor
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 Recognized Expert Expert
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...En d 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
2972
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 supposed to be reported on the printer but I have commented those pieces of code and have got those records printed on the screen. I am using Microsoft Visual C++ 6.0 on Microsoft XP (Home) platform. I am facing some problems in getting desire...
13
6053
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 seperately scheduled to run on a 28 day cycle with different start dates/times. My production SQL server is running SQL Server Enterprise Edition 8.00.760(SP3) on a 2 Processor(4 virtual) Microsoft
6
4986
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 for long running reports. When the processing is complete it uses crystal reports to load a template file, populate it, and then export it to a PDF. It works fine so far....
0
1060
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 pl/pgsql....... I have a table with the schedule of a service my sport team wants to offer:
1
2172
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 <string>
2
2749
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 <string>
3
1919
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 as fun as coding it... And yes alarm bells went off when I found myself typing eval(), and I'm sure this is an 'unusual' use of for: else: . And I know it's not very robust. As an ex cuse/planation, this is what happens when you get an idea in...
1
1084
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 module(periodical daily events ) in java using JSPs for this i developed three JSPs ; !) schedule.jsp 2) schedulePropertystore.jsp3) updateschedule.jsp. action moves from schedule.jsp to updateschedule.jsp updateschedule.jsp to...
7
2324
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 the number never changes, even though the process is running through the proper number of times. What am I missing? Why is the number not appearing to be changing? Sub SetLEAs() Dim MyCnt As Integer Dim i As Integer MYSQL2 =...
0
8443
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8550
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7385
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6192
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5663
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4366
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2769
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.