473,787 Members | 2,938 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.ExecuteNonQ uery, but that's not what I want. Is there a way
to get this to work? Thanks.
Nov 20 '05 #1
1 2046
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_**********@h otmail.com> wrote in message
news:7b******** *************** ***@posting.goo gle.com...
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.ExecuteNonQ uery, 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
2694
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 following error:
1
4178
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 fields from a *single* record from a table called 'Locations' and then apply one of these field's values...
3
2173
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 to mention the nuances of using Do While, Do until, Case statements If statements, IIF etc etc...)...
2
3354
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 sort on the first choosen column ASC or DESC and additionally on a second column ASC. I use the...
11
3078
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 of
2
3228
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 price, treatment code, insured field to become automated(update the corresponding data automatically)....
1
19407
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
7671
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 which parts are optional. Basic SELECT query SELECT <field list> FROM <table/query name(s)>
1
2362
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 alphabetic order by last name. However, the results appear to be in a totally random,...
0
10363
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
10172
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...
1
10110
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,...
0
9964
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
6749
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
5398
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...
0
5535
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.