473,654 Members | 3,097 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 2837
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
4470
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 informations and also a cell with a unique ID of the element. I would like to show at the beginning of each line of the table a couple of cells containing two different icons (one for delete and one
12
4903
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 button or a hyperlink for Modify, Delete and also they want the data displayed not in a HTML table as I am doing but like in a form they want the ability to change the data in the fields. So when the user clicks on the modify button for a row then...
5
4328
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 child table (StudentProgress). The course progress records how a student progresses on a course. I have one course (History) and one student called Maya. I now want to record her grade (64). If I do this in Access using a form, then the form...
5
1248
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 Text</Detail>
4
6198
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
2741
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 is saved the user will be redirect back to the table. This time the record updated will be highlighted so that the user knows where he came from. I basically pass the page number, column and row number via querystring and store the info in a...
16
3485
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 in a hidden field) I wish the user to be able to edit the data in the table, so I have extracted the records into hiddenfield, textareas, dropdown list and checkbox so that they can make changes. I named these elements as arrays and wish to run an...
12
1871
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 modify the table to add an autoincrement primary key (to preserve row order). What I want is to be able to loop my code, ie each 'run' produces one
1
3994
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 am trying to update a contact record with FirstName and LastName contained on a table TblContacts via a Combo Box using the Limit to List function to add new contacts and perform a search to check if the contact is new or already exists on the...
0
8375
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
8290
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,...
1
8482
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
8593
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...
1
6161
isladogs
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...
0
5622
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
4149
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
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1593
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.