I posted that I was having trouble with a SQL statement that was working in
the SQL window, but not in VBA. I have since discovered that when I create
the string in VBA it is over 1023 characters long. When I copy this string
into the SQL window, it splits into two lines, one of 1023 and the remainder
in the next. When I remove that break, the query runs just fine.
Since Access tells me that a string can hold 10^16 (64k), it did not seem to
be a string capacity problem (plus the part of the string that went to the
next line was still there). I searched the archives and saw reference to
VBA limit of 1023 characters per line and that with underscores you could
create a logical line of something like 10 lines of 1023 each. I do not need
anywhere near that much, but it seemed like a solution. But I have no idea
how to implement it; the syntax is unclear to me.
Currently, I set up a string and add to it (i.e. strMySql = "some Sql
Statement" and then strMySql = strMySql +"some other new statement"). I
can now decide to use to variables to catch the first part of the string and
make sure it is less than 1023 and then the rest of the string I can assign
to a second variable. But I have no idea what to do with that. The
underscore character and a new line might be the answer, but how to
implement? Currently, when I have the sql statement built into one
variable, I then use the following:
Set rstMyRecs = CurrentDb.OpenR ecordset(strMyS ql)
When the sql statement is shorter, this works just fine and I get my
recordset and go on from there. How could I use a "logical line" here?
Thanks
Alan
Nov 12 '05
11 50366
On Sun, 18 Jan 2004 23:03:40 GMT, "Colleyvill e Alan" <ae***********@ nospam.comcast. net> wrote: "Wayne Gillespie" <be*****@NObest fitsoftwareSPAM .com.au> wrote in message news:a3******* *************** **********@4ax. com... >
Instead of using line continuations break your string into distinct lines
using vbCrLf and then concatenate the lines together. strMySQL = "This is line one " & vbCrLf strMySQL = strMySQL & "This is line two " & vbCrLf strMySQL = strMySQL & "This is line three " & vbCrLf strMySQL = strMySQL & "This is line four "
Thanks - that worked. Though now I have a 3219 runtime error which I've discovered means I cannot use "OpenRecord set" with an action query, but that is a new problem to solve; the too-long line problem is fixed. Thanks again. Alan
If your SQL string equates to an action query you need to use either Execute (preferred) or RunSQL to run the SQL.
CurrentDB().Exe cute strMySQL, dbFailOnError
or
On Error Resume Next
DoCmd.SetWarnin gs False
DoCmd.RunSQL strMySQL
DoCmd.SetWarnin gs True
On Error GoTo 0
Wayne Gillespie
Gosford NSW Australia
"Wayne Gillespie" <be*****@NObest fitsoftwareSPAM .com.au> wrote in message
news:sb******** *************** *********@4ax.c om... On Sun, 18 Jan 2004 23:03:40 GMT, "Colleyvill e Alan"
<ae***********@ nospam.comcast. net> wrote:"Wayne Gillespie" <be*****@NObest fitsoftwareSPAM .com.au> wrote in message news:a3******* *************** **********@4ax. com... >
Instead of using line continuations break your string into distinct
linesusing vbCrLf and then concatenate the lines together. strMySQL = "This is line one " & vbCrLf strMySQL = strMySQL & "This is line two " & vbCrLf strMySQL = strMySQL & "This is line three " & vbCrLf strMySQL = strMySQL & "This is line four " Thanks - that worked. Though now I have a 3219 runtime error which I've discovered means I cannot use "OpenRecord set" with an action query, but
thatis a new problem to solve; the too-long line problem is fixed. Thanks again. Alan
If your SQL string equates to an action query you need to use either
Execute (preferred) or RunSQL to run the SQL. CurrentDB().Exe cute strMySQL, dbFailOnError
or
On Error Resume Next DoCmd.SetWarnin gs False DoCmd.RunSQL strMySQL DoCmd.SetWarnin gs True On Error GoTo 0
Thanks This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Joe Stevenson |
last post by:
Hi all,
I skimmed through the docs for Python, and I did not find anything like
a case or switch statement. I assume there is one and that I just
missed it. Can someone please point me to the appropriate document, or
post an example? I don't relish the idea especially long if-else
statements.
Joe
|
by: Dave Pylatuk |
last post by:
Hello, I am getting the above error when executing a large insert statement
against 8.1.7.
This insert statement includes a very large string value, about 8000
characters long. Is there a limit on the size of statements that Oracle
can execute ?
Is this a setting that can be changed ?
Thanks in advance.
|
by: Karaoke Prince |
last post by:
Hi There,
I have an update statement to update a field of a table (~15,000,000
records). It took me around 3 hours to finish 2 weeks ago. After that
no one touched the server and no configuration changed. Until
yesterday, I re-ran it again and it took me more than 18hrs and still
not yet finished!!!
What's wrong with it? I can ran it successfully before. I have tried
two times but the result was still the same.
|
by: jeff regoord |
last post by:
A user inputs a float value. The scanf() function gets the value.
However, I need to create an error handler with an if else statement
saying invalid input if the input is not a number. Does anybody know
how I could do this?
|
by: Charles Wilt |
last post by:
I have a IBM iSeries (aka AS-400) running v5r3 of OS/400 that I access
via a linked server from SQL Server 2000.
The following select works fine:
select * from prod400db.test.meldbf.InventoryHistory
However, this insert statement fails:
insert into prod400db.TEST.MELDBF.InventoryHistory
| |
by: sghi |
last post by:
Hi All,
I'm new to this group and quite new to access/vba.
So, shortly after beginning to write a simple application for my wife,
I came across a blocking problem: I need to intercept the sql statement
that stay behind a current, but not yet saved query.
When I work on saved queries I use:
strCurrentName = CurrentObjectName
Dim dbsCurrent As Database
Set dbsCurrent = CurrentDb
|
by: Yevgen Muntyan |
last post by:
Hey,
I was reading C99 Rationale, and it has the following two QUIET CHANGE
paragraphs:
6.5.3.4: "With the introduction of the long long and extended integer
types, the sizeof operator may yield a value that exceeds the range
of an unsigned long."
6.5.6: "With the introduction of the long long and extended integer
|
by: dspfun |
last post by:
Hi!
The words "expression" and "statement" are often used in C99 and C-
textbooks, however, I am not sure of the clear defintion of these
words with respect to C.
Can somebody provide a sharp defintion of "expression" and
"statement"? What is the difference between an expression and a
statement?
|
by: Eric Davidson |
last post by:
DB2 9.5
I keep geting the message.
SQL0101N The statement is too long or too complex. SQLSTATE=54001
When one of my sql statements takes over 60 seconds to compile the sql
statement.
Is there any parameter that controls how long DB2 allows a statement
to compile for.
|
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
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
| |