473,796 Members | 2,737 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

run-time error 3027 Cannot update

97 New Member
(Access 2000/ODBC to MySQL tables)

Hi,

I am getting the run time erro 3027 and it says that "cannot update: database or object is read only." Does anyone see any errors in my code below? Thanks for the help!

My code is

Expand|Select|Wrap|Line Numbers
  1.       outfilename = "ls." & field1 & value1a & "_" & value1b & ".txt"
  2.       MsgBox "outfilename is " & outfilename
  3.       strSQL = "SELECT * INTO [Text;HDR=YES;DATABASE=D:\\AccessData\\myDatabase].outfilename FROM myTable;"
  4.  
  5.          DoCmd.RunSQL strSQL
Mar 14 '08
11 4931
loisk
97 New Member
Hi Stewart again!

Sorry for the incompleted code which I just typed it while it was written, but I have END IF in my real code. (My server is down for other reason right now, so I didn't copy from the real code.) Anyhow, thanks for your quick reply. I will retry with your code as soon as the server is back, and will let you know. Thanks again!
Hi Stewart,

I am back after our server is recovered! (what a bomb!)

I re-coded as you suggested as followings, but I keep getting an error (3067: Query must contain at least one table or query). Here's my code:

Expand|Select|Wrap|Line Numbers
  1.     If Not IsNull(field1) And IsNull(field2) Then                    'if field 1 only
  2.        MsgBox "only field 1 entered"
  3.  
  4.        If Nz(value1a) <> "" And Nz(value1b) = "" Then     '(1)
  5.           MsgBox "Value1a is: " & value1a
  6.              outfilename = "out." & field1 & value1a & ".txt"
  7.              MsgBox "outfilename is " & outfilename
  8.        ElseIf Nz(value1a) <> "" And Nz(value1b) <> "" Then
  9.           MsgBox "Value1b is: " & value1b
  10.           outfilename = "out." & field1 & value1a & "-" & value1b & ".txt"   'value1b & field2 & value2a & value2b &
  11.           MsgBox "outfilename is " & outfilename
  12.  
  13.        End If
  14.  
  15.    ElseIf Not IsNull(field1) And Not IsNull(field2) Then         'if both fields
  16.           MsgBox "field 1 and field 2"
  17.        If Nz(value1a) <> "" And Nz(value1b) = "" And _
  18.           Nz(values2a) <> "" And Nz(value2b) = "" Then     '(3)
  19.            MsgBox "value1a is: " & value1a & "value2a" & value2a
  20.            outfilename = "out." & field1 & value1a & "." & field2 & value2a & ".txt"
  21.            MsgBox "outfilename is " & outfilename
  22.  
  23.        ElseIf Nz(value1a) <> "" And Nz(value1b) <> "" And _
  24.            Nz(value2a) <> "" And Nz(value2b) = "" Then    '(4)
  25.            MsgBox "value1a: " & value1a & "value1b: " & value1b & "value2a: " & value2a
  26.           outfilename = "out." & field1 & value1a & "-" & value1b & "." _
  27.                                      & field2 & value2a & ".txt"
  28.           MsgBox "outfilename is " & outfilename
  29.  
  30.        ElseIf Nz(values1a) <> "" And Nz(value1b) = "" And _
  31.           Nz(values2a) <> "" And Nz(value2b) <> "" Then    '(5)
  32.              MsgBox (value1a) & (value2b)
  33.              outfilename = "out." & field1 & value1a & "." _
  34.                                        & field2 & value2a & "-" & value2b & ".txt"
  35.              MsgBox "outfilename is " & outfilename
  36.  
  37.        ElseIf Nz(values1a) <> "" And Nz(value1b) <> "" And _
  38.              Nz(values2a) <> "" And Nz(value2b) <> "" Then    '(6)
  39.                MsgBox (value1a) & (value2b)
  40.                outfilename = "out." & field1 & value1a & "-" & value1b & "." _
  41.                                        & field2 & value2a & "-" & value2b & ".txt"
  42.                MsgBox "outfilename is " & outfilename
  43.        End If
  44.  
  45.     End If
  46.  
  47.  
  48.  strSQL = "SELECT * INTO [Text;HDR=YES;DATABASE=D:\\Access_data\\miha2008]." & _
  49.                 outfilename & " FROM queryoutput;"
  50.          Debug.Print strSQL
  51.          DoCmd.RunSQL strSQL
*************** *************** ***********
All the msgbox is running fine and it creates the filename fine, except the query.
Apr 14 '08 #11
loisk
97 New Member
Hi Stewart,

I am back after our server is recovered! (what a bomb!)

I re-coded as you suggested as followings, but I keep getting an error (3067: Query must contain at least one table or query). Here's my code:

Expand|Select|Wrap|Line Numbers
  1.     If Not IsNull(field1) And IsNull(field2) Then                    'if field 1 only
  2.        MsgBox "only field 1 entered"
  3.  
  4.        If Nz(value1a) <> "" And Nz(value1b) = "" Then     '(1)
  5.           MsgBox "Value1a is: " & value1a
  6.              outfilename = "out." & field1 & value1a & ".txt"
  7.              MsgBox "outfilename is " & outfilename
  8.        ElseIf Nz(value1a) <> "" And Nz(value1b) <> "" Then
  9.           MsgBox "Value1b is: " & value1b
  10.           outfilename = "out." & field1 & value1a & "-" & value1b & ".txt"   'value1b & field2 & value2a & value2b &
  11.           MsgBox "outfilename is " & outfilename
  12.  
  13.        End If
  14.  
  15.    ElseIf Not IsNull(field1) And Not IsNull(field2) Then         'if both fields
  16.           MsgBox "field 1 and field 2"
  17.        If Nz(value1a) <> "" And Nz(value1b) = "" And _
  18.           Nz(values2a) <> "" And Nz(value2b) = "" Then     '(3)
  19.            MsgBox "value1a is: " & value1a & "value2a" & value2a
  20.            outfilename = "out." & field1 & value1a & "." & field2 & value2a & ".txt"
  21.            MsgBox "outfilename is " & outfilename
  22.  
  23.        ElseIf Nz(value1a) <> "" And Nz(value1b) <> "" And _
  24.            Nz(value2a) <> "" And Nz(value2b) = "" Then    '(4)
  25.            MsgBox "value1a: " & value1a & "value1b: " & value1b & "value2a: " & value2a
  26.           outfilename = "out." & field1 & value1a & "-" & value1b & "." _
  27.                                      & field2 & value2a & ".txt"
  28.           MsgBox "outfilename is " & outfilename
  29.  
  30.        ElseIf Nz(values1a) <> "" And Nz(value1b) = "" And _
  31.           Nz(values2a) <> "" And Nz(value2b) <> "" Then    '(5)
  32.              MsgBox (value1a) & (value2b)
  33.              outfilename = "out." & field1 & value1a & "." _
  34.                                        & field2 & value2a & "-" & value2b & ".txt"
  35.              MsgBox "outfilename is " & outfilename
  36.  
  37.        ElseIf Nz(values1a) <> "" And Nz(value1b) <> "" And _
  38.              Nz(values2a) <> "" And Nz(value2b) <> "" Then    '(6)
  39.                MsgBox (value1a) & (value2b)
  40.                outfilename = "out." & field1 & value1a & "-" & value1b & "." _
  41.                                        & field2 & value2a & "-" & value2b & ".txt"
  42.                MsgBox "outfilename is " & outfilename
  43.        End If
  44.  
  45.     End If
  46.  
  47.  
  48.  strSQL = "SELECT * INTO [Text;HDR=YES;DATABASE=D:\\Access_data\\miha2008]." & _
  49.                 outfilename & " FROM queryoutput;"
  50.          Debug.Print strSQL
  51.          DoCmd.RunSQL strSQL
*************** *************** ***********
All the msgbox is running fine and it creates the filename fine, except the query.
My apology! There were a couple of variable name misspelled! It works fine after fixing those. Thanks!
Apr 14 '08 #12

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

Similar topics

3
4932
by: leroybt.rm | last post by:
Can someone tell me how to run a script from a interactive shell I type the following: >>>python filename >>>python filename.py >>>run filename >>>run filename.py >>>/run filename >>>/run filename.py
4
3217
by: Ed | last post by:
Hello, I took a course in asp about 2 years ago and I was practicing with IIS 5.0. Then I put it down for a while. Now trying to get back to it. I can't run asp files from subdirectories of my root directory, but I can run asp files from the root directory of my website and I can run htm files from the subdirectories. If I run localhost/mytest.asp
2
2544
by: Jenna Olson | last post by:
Hi all- I've never seen this particular issue addressed, but was wondering if there's anything to support one way or another. Say I have a class: class ManipulateData { public: ManipulateData(const char* Path-To-Some-Text-File) { ... }
15
4290
by: mg | last post by:
How can I run an .exe using C# from within the code behind of a WebForm app?
6
2642
by: billr | last post by:
I have developed a small API for taking care of a lot of boiler plate stuff in a multi formed windows application, for example setting up a messaging thread framework. New Forms, in the appllication using the API, are subclassed to a Form contained within the API, and they are controlled (controlled in this instance means, kept alive, displayed and hidden) at runtime by a thread whose responsibility is this sole task. In order to run...
13
5097
by: Bob Day | last post by:
Using vs2003, vb.net I start a thread, giving it a name before start. Code snippet: 'give each thread a unique name (for later identification) Trunk_Thread.Name = "Trunk_0_Thread" ' allow only 1 thread per line Trunk_Thread.ApartmentState = ApartmentState.STA
9
19742
by: shank | last post by:
What is the proper syntax to run this command line in ASP? wzzip.exe File.zip File.txt thanks
19
2227
by: Bryan | last post by:
How can i run a bit of code straight from the IDE? Right now i make a temporary button and put the code behind that, then i run debug mode and click on the button. Is there a way to highlight some code and tell it to run that? Is there a "scratchpad" type window like in VBA where I can write some simple code to be executed? Thanks for the help in advance
7
2949
by: Lee Crabtree | last post by:
I remember when I was first getting into .NET Forms programming that there was a rather emphatic rule about not constructing a form before calling Application.Run with it. So this: Application.Run(new Form1()); was okay, but this: Form1 form = new Form1();
7
11748
by: mxdevit | last post by:
Task: run application from ASP.NET for example, you have a button on ASP.NET page, when press this button - one application is invoked. the code to run application (for example, notepad) is (on C#) System.Diagnostics.Process.Start("notepad");
0
9685
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
9535
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,...
0
10465
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10242
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10021
tracyyun
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...
0
9061
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...
0
6800
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
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3744
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.