473,503 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using SQL to modify a record.

4 New Member
Im still very new to access and probably way off track here.
But Im trying to create a SQL statement to overwrite an existing single record in access.
I tryed using this statement but it comes up with an error saying "query input must contain at least one table or query." ive been trying for a couple of hours and thats the error i get basiclly saying im way of track. Can anyone help please? The code i have so far is...

Expand|Select|Wrap|Line Numbers
  1. Dim mySQL As String
  2. mySQL = "INSERT INTO Journal ( Description )"
  3. mySQL = mySQL + " VALUES (Me![Comment])"
  4. mySQL = mySQL + " WHERE (((Journal.'Journal ID') = 3))"
  5. DoCmd.RunSQL mySQL
The tables name is Journal and the field is called Description and the record is 3 of the "journal ID"'s Autonumber. The data i want in there is from (Me![Comment]) Hope that all makes sense.
Thankyou for your help! :)
Dec 5 '08 #1
3 2824
mshmyob
904 Recognized Expert Contributor
Looking quickly at this I would put Journal ID in square brackets not single quotes.

You should get into the habit of never using spaces for naming conventions.

cheers,
Dec 5 '08 #2
zapras
4 New Member
Thanks for that. But im thinking why it dosnt work is because you cant have a WHERE statement in a INSERT INTO statement

Can someone else please help me with this? Maybe with an UPDATE statement?
Trying my hardest but i just dont know enough about it. (and dont know how to learn it for that matter)
Thankyou!
Dec 9 '08 #3
ChipR
1,287 Recognized Expert Top Contributor
"UPDATE Journal SET Description = """ & Comment & """ WHERE Journal_ID = 3"
Dec 9 '08 #4

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

Similar topics

1
4461
by: Franco Fellico' | last post by:
Hi. Suppose to have read and displayed (using PHP) a group of row of a DB table on a dinamyc table on a HTML/PHP page. The number of row displayed could be from 1 to n. Each row contains...
12
4885
by: Venkat | last post by:
Greetings to All, I have the following file and i need to modify it with the contents of an array File1.txt Name Location Points Grade Venkat,Newyork,100,A Jack,LA,12,C
0
422
by: karenmiddleol | last post by:
The following code works fine I can connect to a SQL database and list all the records in the Orders table onto a web page. Now our users want me to modify it so that each row displayed as a...
5
4317
by: Ilan Sebba | last post by:
When it comes to adding records in related tables, Access is really smart. But when I try to do the same using ADO, I am really stupid. Say I have two parent tables (eg Course, Student) and one...
5
1231
by: Allan A via DotNetMonster.com | last post by:
I have a xml document created <?xml version="1.0" standalone="yes" ?> <Group> <Information> <ID>44</ID> <Detail>Hello World</Detail> </Information> <Information> <ID>45</ID> <Detail>My...
4
6183
by: muttu2244 | last post by:
Hi everybody Am trying to read a csv file "temp.csv", which has the below info, compName macAddr ipAddr opSys
3
2732
by: sean | last post by:
I have a table with fixed row of records SORTED by DATE using ADO pagination method. The user can click a link in one table cell and go to another page to modify the record. Once the updated record...
16
3460
by: Ian Davies | last post by:
Hello Needing help with a suitable solution. I have extracted records into a table under three columns 'category', 'comment' and share (the category column also holds the index no of the record...
12
1856
by: sandiptaylor | last post by:
Hi, I have a query that generates a table with following columns follows: Aaa Aa1 Aa2 Aa3 Baa1 Baa2 Baa3 Ba1 Ba2 Ba3 B1 B2 B3 CCaa D This is generated by an insert into statement. I then...
1
3987
by: Jason Northampton | last post by:
Hello This is the first time I've used a discusion forum and up until now I have managed to use and or modify VB code from the various sites on the web, until now! This is a simple problem and I...
0
7083
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...
0
7278
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,...
0
7328
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...
0
7456
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...
0
5578
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,...
0
4672
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
3153
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1510
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 ...
0
379
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.