473,396 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Having trouble with Append query

11
I'm having trouble with an append query involving variables supplied by the user. I have input boxes pop up to enter a ticket number and initials. The query is supposed to copy info from a table, along with the 2 inputs from the user, into another table. it works with just the first input, but adding the second gives a parameter error. Here's a condensed version of my code:

Expand|Select|Wrap|Line Numbers
  1. Dim VarTermTicket As String
  2. Dim VarTermedBy As String
  3.  
  4. VarTermTicket = InputBox("Please enter term ticket:")
  5. VarTermedBy = InputBox("Please enter your initials:")
  6.  
  7. AppendTermedUser = "INSERT INTO TermedSabre (ID, FirstName, LastName, TermTicket, TermedBy, TermDate) SELECT SabreUsers.ID, SabreUsers.FirstName, SabreUsers.LastName, " & VarTermTicket & ", " & VarTermedBy & ", Date() AS Expr1 FROM SabreUsers WHERE SabreUsers.ID = " & UserID & ""
  8. DoCmd.RunSQL (AppendTermedUser)
When I run it, the inputs pop up just fine, I enter let's say 1 for the ticketNumber and "SSD" for initials and I get a box saying "Enter Parameter Value" for SSD. If I take out everything for the initials/varTermedBy the query works just fine, so I think I must be referencing it incorrectly or using the quotes wrong. Any help out there?

Thanks

PS. I should add that if I cancel out of the box asking for the parameter it gives me "run-time error '3270': Reserved Error"
Oct 20 '11 #1
2 1651
Rabbit
12,516 Expert Mod 8TB
If you're trying to use a literal string value in a query, you need to surround it in single quotes.

Expand|Select|Wrap|Line Numbers
  1. select 'hello'
  2.  
  3. as opposed to 
  4.  
  5. select hello
Oct 20 '11 #2
NeoPa
32,556 Expert Mod 16PB
You should also realise that copying such data is very poor database design as it flouts the concepts of normalisation. See Database Normalisation and Table structures for more on that. One of, if not the, most important issue as far as database design goes.
Oct 21 '11 #3

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

Similar topics

2
by: John | last post by:
Hi - I am trying to perform a simple append query, with no luck. I have a table (MktPrices) that has the following fields: BondID, PriceDate, Price. The objective is to allow the user to input a...
2
by: Paul Wagstaff | last post by:
Hi there I have 2 tables: tblAccuracy & tblClearance Users add new records to tblAccuracy using frmRegister. Under specific conditions I need to append the current record from frmRegister into...
1
by: Gregg | last post by:
I created an append query that pushed 100's of orders form one table into another. I'd like to assign a new order number to each order as I append them to the new table based upon the maximum...
1
by: aaronm49 | last post by:
I have created an append query and I am having a problem with the format of the number column when it appends. For example. 4.5 appends as 4,a value of .5 appends as 0. I have adjusted the append...
4
by: robboll | last post by:
When I try to use an append query from an oracle link it takes forever. I am exploring the idea of doing an append action using a pass-through query. If I have an Oracle ODBC connection to...
0
by: harry12 | last post by:
Hello- I'm fairly new at using Microsoft Access and I'm having trouble getting a couple of things to work in my database. The first is that I have yet to find a way to get an append query to...
6
by: MLH | last post by:
I have a query with a single table. One of the table fields appearing in the QBE grid is containing values from 1 to 127. Then I have the following calculated field named : Published: IIf((1...
4
by: franc sutherland | last post by:
Hello, I am using Access 2003. I am having trouble trapping the "can't append all the records in the append query" error message when appending data to a query from a table which is linked to...
6
by: slenish | last post by:
Hello, First just want to say im going to try and explain this the best I can and hope i dont confuse people :) What I have is a form to delete a record. Now what I have set the form up to...
3
by: jaesik | last post by:
Hi all, I've been working on my personal portfolio website and been struggling a lot because of J-query. Since my j-query level is not like master.. I usually modify existing j-query plugins to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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
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...
0
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
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,...

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.