473,507 Members | 2,447 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Another run-time error 3061 issue

I noticed several postings about issues related to "run-time error
3061", and I observed that the solutions to these issues appear to
involve correcting something within the SQL code. I'm encountering
the "run-time error 3061" issue, but I'm not sure how to go about
correcting the SQL. My hunch is that I have not properly constructed
things to identify a date field, but I don't know how to correct this
issue. In addition to not understanding how to correct the issue, I
do not understand why the query works when it is manually invoked, but
it fails to work when it is invoked within VBA code...seems as though
it would never work if I had incorrectly constructed the query.

My questions are:
1) what changes can I make to the query to avoid this error?
2) why does the query work when invoked from the query tab, but not
work when invoked within VBA code?

The stuff below provides more details.

- Running Access 2000
- created a 2-field query qryFDateInPast
- query relies on the contents of a field from a form
- when the form is open, and the field populated, am able to run the
query from the query tab within Access
- when the form is open and the field populated, receive the '3061'
error when running the VBA code below
- if I modify the query so that the second field is a non-date field
from tblDocumentSetup, then I do not get the error...this is what
leads me to believe that I'm not formatting things correctly to
identify a date field

Within the query, the second field is defined as:
FDateInPast: IIf([FromDate]<[Forms]![frmSwitchboardAdmin]![txtMonthEnding],"Y","N")

The SQL view of the query is:
SELECT tblDocumentSetup.ID,
IIf([FromDate]<[Forms]![frmSwitchboardAdmin]![txtMonthEnding],"Y","N")
AS FDateInPast
FROM tblDocumentSetup;

The field FromDate in tblDocumentSetup is defined as a Date/Time
field.

The field [frmSwitchboardAdmin]!txtMonhtEnding is a text box with
format of short date. I have been filling in this text box field with
the value 05/16/2004.

VBA code:
Dim db As Database
Dim rstZZZ As Recordset
Set db = CurrentDb()
Set rstZZZ = db.OpenRecordset("qryFDateInPast")

I get the same result if I try:

Dim db As Database
Dim quoteChar as String
quoteChar = """"
Dim strSQL as String
Dim rstZZZ As Recordset
Set db = CurrentDb()
strSQL = ""
strSQL = strSQL & "SELECT "
strSQL = strSQL & "tblDocumentSetup.ID, "
strSQL = strSQL & "IIf([FromDate]<[Forms]![frmSwitchboardAdmin]!"
strSQL = strSQL & "[txtMonthEnding],
strSQL = strSQL & quoteChar & "Y" & quoteChar & ","
strSQL = strSQL & quoteChar & "N" & quoteChar & ") AS FDateInPast "
strSQL = strSQL & "FROM tblDocumentSetup"
Set rstZZZ = db.OpenRecordset(strSQL)
Nov 12 '05 #1
0 3298

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1819
by: Howard Rothenburg | last post by:
Here is an example of running a different ASP page from a current web page, using Javascript. function window_onunload() { var objSrvHTTP; var objDoc; var URL = "http://" +...
1
3457
by: Khue Pham | last post by:
Does anyone knows how to copy database from one server to another. By copying I mean literally everything, not just the database. I know we can dump the database from one server then reload it to...
3
1879
by: Larry R Harrison Jr | last post by:
I designed this webpage: http://www.dbases.net/photography_pages/new_style_frames_index.html It has horizontal hover/pop-down menus; it works fine on the given machine run off the hard drive,...
4
3382
by: keepyourstupidspam | last post by:
Hello, I have a class X with a member function setConfigValues(). I want to access this member function in another class Y. Y is not inherited from X. A member function of class X called run()...
5
1976
by: nephish | last post by:
hey there all, i have been looking for a way to run a php command line script from my python script. here is what i want to do: if x = 4: execute php4 testin.php else: execute php4...
0
1245
by: vulcaned | last post by:
Hi All, In Access97 I have a database(MasterControl), it has a form(MainMenu) with four buttons on it. On the click event of each button on the MainMenu form I want it to open another Access97 db...
10
14399
by: Sorin Dolha [MCSD .NET] | last post by:
I would like to start a process from C# code as another user. The C# code is executed as the ASPNET user because it relies in a Web Page class, and I would like that the process will run as another...
1
38942
by: Galaxia | last post by:
Hi, I am using C# of VS .Net 2003. I want to call another executable file (.exe) in my program. How can I do it? Thanks. -- "Forward Galaxia"
2
2192
by: Selen | last post by:
I have a aspx file in my computer.I want to run it another computer in network. I write http://computername/filename but it doesnt work.Why can it be ? How can I solve the problem Thanks
8
2042
by: MSDN Account | last post by:
I have looked at the documentation for 'Microsoft.Win32.Registry' and 'System.Security.Permissions.RegistryPermission' but am still stuck, hoping some can give me a nudge in the right direction. ...
0
7221
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
7372
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...
1
7029
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...
0
5619
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,...
1
5039
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...
0
4702
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...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.