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 - SELECT *
-
FROM TblOneDayOnly
-
WHERE (ProgIn =3 OR ProgIn =1) AND (ProgOut =3 OR ProgOut =1);
- Private Sub cmdExport_Click()
-
On Error GoTo Finalstep
-
Dim querystring As String
-
Dim dbase As DAO.Database
-
Dim rsSchedules As DAO.Recordset
-
Dim tempi As Integer
-
Dim rptcnt As Integer
-
rptcnt = 0
-
If (Me.Optgroup.Value = optScheduleweek.OptionValue Or _
-
Me.Optgroup.Value = optcharAdhweek.OptionValue) And _
-
(DateTime.Weekday(txtStartDate.Value, 2) <> 5) Then
-
MsgBox "The start date is not a Friday, Pls select a friday as start date", vbCritical, "Error"
-
Exit Sub
-
End If
-
-
querystring = GetQueryString
-
If (Len(Trim(querystring)) > 0) Then
-
Set dbase = CurrentDb
-
If (Me.Optgroup.Value = OptMonthly.OptionValue) Then
-
MsgBox "Exporting monthly report for " & CStr(txtStartDate.Value) & _
-
" to " & CStr(txtEndDate.Value), vbExclamation, "Export"
-
tempi = 1
-
Set rsSchedules = dbase.OpenRecordset(querystring)
-
If rsSchedules.RecordCount > 0 Then
-
rsSchedules.MoveLast
-
rptcnt = rsSchedules.RecordCount
-
-
End If
-
If rptcnt = 0 Then GoTo Message
-
CreateMonthlyReport rsSchedules, GetWeekDay(tempi)
-
-
-
ElseIf (Me.Optgroup.Value = optScheduleweek.OptionValue) Then
-
-
MsgBox "Exporting One Day Schedule Flight Activity for " & CStr(txtStartDate.Value) & _
-
" to " & CStr(txtEndDate.Value), vbExclamation, "Export"
-
Set rsSchedules = dbase.OpenRecordset(querystring)
-
If Not (rsSchedules.EOF = True) Then
-
CreateWeeklyScheduleReport rsSchedules
-
rptcnt = 1
-
End If
-
rsSchedules.Close
-
-
ElseIf (Me.Optgroup.Value = optcharAdhweek.OptionValue) Then
-
-
MsgBox "Exporting One Day Charter & Adhoc report for " & CStr(txtStartDate.Value) & _
-
" to " & CStr(txtEndDate.Value), vbExclamation, "Export"
-
Set rsSchedules = dbase.OpenRecordset(querystring)
-
If Not (rsSchedules.EOF = True) Then
-
CreateWeeklyAdhCharReport rsSchedules
-
rptcnt = 1
-
End If
-
rsSchedules.Close
-
ElseIf (Me.Optgroup.Value = OptArrivalDate.OptionValue) Then
-
-
MsgBox "Exporting One Day Daily Flight Activity for " & CStr(txtStartDate.Value)
-
Set rsSchedules = dbase.OpenRecordset(querystring)
-
If Not (rsSchedules.EOF = True) Then
-
CreateDailyReport rsSchedules
-
rptcnt = 1
-
End If
-
rsSchedules.Close
-
-
End If
-
Message:
-
dbase.Close
-
If Me.Optgroup.Value <> optcharAdhweek.OptionValue Then
-
If (rptcnt = 0) Then
-
MsgBox "No Repords Found for Excel Export", vbExclamation, "Export"
-
Else
-
MsgBox "Export to excel file(s) completed", vbExclamation, "Export Complete"
-
End If
-
End If
-
Set rsSchedules = Nothing
-
Set dbase = Nothing
-
End If
-
-
Exit Sub
-
Finalstep:
-
MsgBox Err.Description, vbCritical, "Error"
-
-
End Sub
2 1807
You can change: - 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
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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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...
|
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
|
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....
|
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:
|
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>
| |
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>
|
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...
|
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...
|
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 =...
|
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...
|
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,...
| |
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,...
|
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...
|
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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |