473,513 Members | 2,881 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access field name & brackets problem

I have an Access db (actually, about 60 of them) that has a table with
a field named Q#. This table gets read into a dataset. In the dataset,
the field is also called Q#. But when I try to update the db, an error
occurs because Access wants the field to be surrounded by brackets -
[Q#] - when written back. I know this is the problem, because if I
change the fieldname to QNum, it works fine.
Using the commandbuilder, or building the INSERT, UPDATE, or DELETE
manually without brackets, the error is "Syntax error in INSERT
statement..." (or UPDATE, etc). When I build them manually with
brackets, the error is "No value given for one or more required
parameters..."
An example of the manual statement is: INSERT INTO QS (Q#, QText)
VALUES(?, ?)
I don't want to change the fieldname in Access because there are so
many db's, and the field is used in many queries, forms, etc. I want
to make all changes to the dataset and update all at once. It works
using cmd.ExecuteNonQuery, but that's not what I want. Is there a way
to get this to work? Thanks.
Nov 20 '05 #1
1 2030
There is a QuotePrefix and a QuoteSuffix propert, which is used by the
command builder to put the correct characters around table and column names
to make queries run.

Set those properties to [ and ], respectively.

"Greg" <s_**********@hotmail.com> wrote in message
news:7b**************************@posting.google.c om...
I have an Access db (actually, about 60 of them) that has a table with
a field named Q#. This table gets read into a dataset. In the dataset,
the field is also called Q#. But when I try to update the db, an error
occurs because Access wants the field to be surrounded by brackets -
[Q#] - when written back. I know this is the problem, because if I
change the fieldname to QNum, it works fine.
Using the commandbuilder, or building the INSERT, UPDATE, or DELETE
manually without brackets, the error is "Syntax error in INSERT
statement..." (or UPDATE, etc). When I build them manually with
brackets, the error is "No value given for one or more required
parameters..."
An example of the manual statement is: INSERT INTO QS (Q#, QText)
VALUES(?, ?)
I don't want to change the fieldname in Access because there are so
many db's, and the field is used in many queries, forms, etc. I want
to make all changes to the dataset and update all at once. It works
using cmd.ExecuteNonQuery, but that's not what I want. Is there a way
to get this to work? Thanks.

Nov 20 '05 #2

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

Similar topics

23
2655
by: JustMe | last post by:
I don't know if this has anything to do with AccessXP running on Terminal Services with Access97/2000 also installed, but here is one example of a query that does not work any longer: SELECT DLookUp("MajorCategory","AutoTypes","='1'") AS MajorCategory, PreOwned.PaintColor FROM PreOwned; When I try to run the above query I get the...
1
4157
by: Andrew McNab | last post by:
Hi folks, I have a problem with an MS Access SQL query which is being used in an Access Report, and am wondering if anyone can help. Basically, my query (shown below) gets some records from a couple of tables in my database using INNER JOINS and the WHERE clause to specify the required constraints. However, I also want to read two...
3
2163
by: Iain Miller | last post by:
Can anybody help me with some Access 2000 code? I don't do a lot of coding in Access & so every time I come back to do something I pretty much have to relearn the syntax from scratch so this is taking me hours. As with most occasional programmers its the commas, colons, inverted commas, square brackets etc etc that cause the problem! (Not...
2
3329
by: Dutchy | last post by:
Hi there, After spending several hours trying all I could imagine and search for in Google I gave up. In a continuous form I want to sort the choosen column by clicking the header (label) of that column. I even want to sort up and down if one clicks again on the same header. No problem so far, all works well for one column. Now I want to...
11
3048
by: Eych | last post by:
I get a VB error when I try to update a table whose field I change with the following statement: dcUpdate.Dataset.Tables(0).Rows(0)("User Name") = Me.textbox1.Text if I change the field name to "UserName", one word, in the table and in the statement above, it works... realistically, I can't do this since the users already have a copy...
2
3218
by: Michael Bialowas | last post by:
Hello all, I have been searching the net endlessly and found this ng, so I thought I would give a try. Anyways, I have a few problems I am trying to implement a combo box which presently contains the following: Description, Price, and Treatment code. I wish to do the following: when the description field(combo box) is clicked I want the...
1
19384
MMcCarthy
by: MMcCarthy | last post by:
Access has a number of built-in functions which can be generally used in queries or VBA code. Some of the more common ones are: Note: anything in square brackets is optional Date Functions Date() - Returns the current system date Now() - Returns the current system timestamp (date and time)
0
7643
MMcCarthy
by: MMcCarthy | last post by:
Rather than using the Access design view change the view to SQL. I am going to attempt to outline the general syntax used for SQL queries in Access. Angle brackets <> are used in place of some syntax elements you must supply. The description of these elements will be in the contained in the angle brackets. Square brackets are used to show...
1
2353
by: Brit | last post by:
I have an ASP file that retrieves names from an Access database for 4 different categories of membership, which the visitor to the page selects (corporate, institutional, regular, or student). The DNS name is "cati", the names are specified in the "Last_names" field, and the categories are in the "categories" field. l want the results sorted in...
0
7269
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...
0
7177
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...
1
7123
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...
0
7542
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...
0
5701
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...
0
4756
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...
0
3237
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1611
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
0
470
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.