INSERT INTO problems - 12305

Hi all,

I hope this doesn't appear twice, I did it a while ago and it never
came up!  So here goes again!

I am trying to use INSERT INTO to insert one record in to a table (tna
feedback) in two fields (USER ID: and DESK/LAPTOP).

The values are generated by two different forms; stUser comes from
this form and stMachine comes from another form which has been hidden
once the user has chosen the value.  This part works fine.

However, every time I run it I get an "Incomplete Query clause" error
message but can't fidure out what I've done wrong!

Here is the code:

Dim SQL As String
Dim stUser As String
Dim stMachine As String
Dim stTable As String



    If IsNull(Me.DESK_LAPTOP) Or (Me.DESK_LAPTOP) = "" Then
        If 1 = MsgBox("Please enter User ID and Laptop/Desktop into
TNA form", vbOKOnly, "Missing Data!") Then

      User_id.SetFocus
      stUser = Me.User_id.Text

      DoCmd.OpenForm "Frm:TNA_Feedback", , , , , acDialog

      stMachine = [Forms]![Frm:TNA_Feedback]![Text3]
      stTable = "tna feedback"

       SQL = "INSERT INTO'" & stTable & "'([USER ID:], DESK/LAPTOP)
VALUES ('" & stUser & "','" & stMachine & "');"

       DoCmd.RunSQL SQL

       DoCmd.Close acForm, "Frm:TNA_Feedback"

       GoTo Exit_Command25_Click

    End If
    End If

I realise that the table and field names are not ideal but someone
else set up the database and to change these would require changing
every single query in the database!!!

Please help me, this is baffling me!

Ben

0
ginge6000
3/13/2007 12:43:15 PM
access.forms 6864 articles. 2 followers. Follow

1 Replies
693 Views

Similar Articles

[PageSpeed] 7

ginge6000@hotmail.com wrote:
> Hi all,
> 
> I hope this doesn't appear twice, I did it a while ago and it never
> came up!  So here goes again!
> 
> I am trying to use INSERT INTO to insert one record in to a table (tna
> feedback) in two fields (USER ID: and DESK/LAPTOP).
> 
> The values are generated by two different forms; stUser comes from
> this form and stMachine comes from another form which has been hidden
> once the user has chosen the value.  This part works fine.
> 
> However, every time I run it I get an "Incomplete Query clause" error
> message but can't fidure out what I've done wrong!
> 
> Here is the code:
> 
> Dim SQL As String
> Dim stUser As String
> Dim stMachine As String
> Dim stTable As String
> 
> 
> 
>     If IsNull(Me.DESK_LAPTOP) Or (Me.DESK_LAPTOP) = "" Then
>         If 1 = MsgBox("Please enter User ID and Laptop/Desktop into
> TNA form", vbOKOnly, "Missing Data!") Then
> 
>       User_id.SetFocus
>       stUser = Me.User_id.Text
> 
>       DoCmd.OpenForm "Frm:TNA_Feedback", , , , , acDialog
> 
>       stMachine = [Forms]![Frm:TNA_Feedback]![Text3]
>       stTable = "tna feedback"
> 
>        SQL = "INSERT INTO'" & stTable & "'([USER ID:], DESK/LAPTOP)
> VALUES ('" & stUser & "','" & stMachine & "');"
> 
>        DoCmd.RunSQL SQL
> 
>        DoCmd.Close acForm, "Frm:TNA_Feedback"
> 
>        GoTo Exit_Command25_Click
> 
>     End If
>     End If
> 
> I realise that the table and field names are not ideal but someone
> else set up the database and to change these would require changing
> every single query in the database!!!
> 
> Please help me, this is baffling me!
> 
> Ben
> 

Look at Rick Brandt's post. You have single quotes that are not needed
after INTO and Before ([User.

Ron
0
rwr
3/13/2007 3:18:12 PM
Reply:

Similar Artilces:

Problem after SP2 Install
After installing SP2 for XP,sometimes outlook won`t connect to my pop3 mail server.After I restart the computer it is fine for one connection then it won`t connect again unless I reboot.Can someone please help.Thanks in advance. Rich ...

Formatting Problem #2
I have a workbook with 9 worksheets. All but one of them are used to track different company projects, one is used for summary: various counts and sums. On the summary sheets, the individual project are separated by two blank rows. The summary data was formatted with borders. I need to remove the borders, which is easy to do. The problem is that when all the borders are removed, vertical "lines" remain that span many rows, between several columns. Removed gridlines, with no effect. These are not drawn objects. Does anyone have an idea how to remove this? Thanks Dudley Could th...

Sending mail problem
Hi there, when i try to send a mail from CRM gives me an error "Unspecified error" i installed Exchange server on the same machine and it's working ...

tab order problem #2
I have a form with 2 edit boxes 3 buttons and a listcrl on it. I set the tab order to go to the edit box1, edit box2, add button, edit button and submit button and listctrl. The way that it works is I add text to edit box1 & edit box 2, press the add button and the text goes to the listctrl. I can then press the tab to go to edit button and submit button until I get back to edit box 1, to add more text. The problem started when I added code to add button so that when I press it to add the text to the listctrl it will automatically setfocus back to edit box1. It works fine until I ad...

OneNote Insert > Extra Writing Space. How do you remove extra spac
When I insert "Extra Writing Space" in OneNote, sometimes I may decide I don't need. Is there a way to remove it? I scroll back to the top of the page and, if there's no content there, ON2007 removes the extra space automatically. Do you insert extra space manually? ON2007 should insert it for you automatically as you type. "hfongster" wrote: > When I insert "Extra Writing Space" in OneNote, sometimes I may decide I > don't need. Is there a way to remove it? If you're using the Extra Writing Space option from the Tool...

problem in OWA
I have installed two exchange 2003 on pcs in Front end & back end topology, But whenever i send message through OWA, i get error message " forbidden " from internet explorer, i have checked everything ,& iam able to send mail through otlook ,this is happening to all users please note that I only get "forbidden" message with no error code Please provide solutions, Thanks in advance, Regards, Pritam T Have you by chance used IISLockdown or URLScan tools? pritz wrote: > I have installed two exchange 2003 on pcs in Front end & back end > topology, But when...

Problems Posting
Is anyone else having problems posting questions? Each time I get this message: An error occurred while sending your pos -------------------------------------------------------------------------------- We're sorry, but there was a problem with the system and your post was not received. The error has been reported to Operations and will be investigated as soon as possible. Please try again later. - Close =?Utf-8?B?RU1jR3JhdGhASENBX05PU1BBTV9WZW5kb3IuY29t?= <EMcGrathHCANOSPAMVendorcom@discussions.microsoft.com> wrote in news:2E96F53C-99CF-4B1A-8016-B05A210B52BA@microsoft....

outlook problem with decode and combine
When I go into user groups and download a file that is broken into 450 files. I select all of them and then I use the decode and combine option to download those files. It works fine but where I have a problem is if I have a file that contains more than 512 files the decode and combine will go no further than 512 files. How can I change this to allow the decode and combine in outlook express to download more than 512 files. Thank you ...it would be appreciated if you emailed me with any suggestion alvarezt@optonlone.net This newsgroup is for support of Outlook 97, 98, 2000 & 2002 fro...

Outlook problem after OS reinstall
I have just completed an XP pro reinstall. I then installed BitDefender IS - my old install had AVG9. I then copy/pasted my saved outlook and archive .pst files into my new install at - C:\Documents and Settings\Administrator\Local Settings\Application Data \Microsoft\Outlook Now when I start up Outlook it starts with an error because it cannot find avgxch32.dll! I just click to ignore and I Outlook runs OK Can anyone advise me how to resolve this issue and stop Outlook looking for this AVG file? Remove it from your Add Ins. <craigmill@sky.com> wrote in message new...

Figured out Search/Replace Problem
Thanks, anyway! ...

Insert date into file import
I have a database that imports a .csv file generated by anotherprogram. Unfortunately this program doesn't include a date in eachrecord in the .csv file.I can import the .csv file into my table alright, but I need to attach/insert a date (which I can get via VB code) into each importedrecord. Any ideas?At the moment I'm using the Docmd.TransferText command. have you tried importing the data, then running an Update query on thetable, to add a date to each record?hth<b_lwalker@hotmail.com> wrote in messagenews:1174264665.772034.212550@n59g2000hsh.googlegroups.com...> I have a ...

CPrintDialogEx problem
Hi, I've started using the Ex version of the print dialog. All has been fine until I've pressed the 'Apply' button. The only thing showing on the call stack I can see is: if (bCallDefault) lResult = CallWindowProc(oldWndProc, hWnd, nMsg, wParam, lParam); in: _AfxActivationWndProc(..) with oldWndProc == NULL. And the error is: Invalid Address specified to RtlReAllocateHeap( 00150000, 00757250 ) Unhandled exception at 0x7c901230 in ars.exe: User breakpoint. So, I figured I wanted notification of 'Apply' and copied the CPrintDialogEx stuff to my own files and re...

alias Problem
Hi, I want to create an alias for a user on exchange2000. I have created one user johnr@domain.com on my exchange and active directory. now i changed its alias as j but when i am sending mail to j@domain.com it is not reaching on jonr@domain.com. Pls let me know how to create alias in Exchange. Regards, Abhi pandeyabhishek2000@yahoo.com (abhishek pandey) wrote: >Hi, >I want to create an alias for a user on exchange2000. I have created >one user johnr@domain.com on my exchange and active directory. now i >changed its alias as j but when i am sending mail to j@domain.com it >is...

Problem opening files from server
When attempting to open a file from the server by clicking the short cut to the folder on the server, then the file I get the following message: Windows cannot find 'L:\name_of-file.xls'. Make sure you typed the name correctly, and then try again. If I bring up excel 2007, then click the "folder" to the right of the 'Office Button' (upper left hand corner), it brings up a listing of the network drives and the files under them. I can click on the *.xls that I desire to open and it opens it without a problem. Also, I can click the 'Office Button' and th...

Problem using SaveAs method
Hi, I'm running a perl script which uses Win 32 OLE package for Excel operations. The script does some processing and populates a spreadsheet, after which it uses the 'SaveAs' method to save it as xls in the same folder in which the tool runs. This used to work fine until recently I upgraded from MS Office 2003 to MS Office 2007 version 12.0.6524.5003. Now, the script does not produce any xlsx file at all. I tried the same on another machine running Excel 2007 version 12.0.4518.1014, and surprisingly it generated the xlsx. Is this some known issue with this ver...

Execute Problem
I have a database with the following code from a macro: DoCmd.TransferSpreadsheet acImport, 8, "Schneidernew", Me.File, False, "A2:K300" MsgBox "Data Importing Complete.", , "" With cmd1 ..ActiveConnection = CurrentProject.Connection ..CommandText = "Schneider_Append_DDR;" ..Execute End With With cmd1 ..ActiveConnection = CurrentProject.Connection ..CommandText = "Update_Carrier_Schneider;" ..Execute End With DoCmd.DeleteObject acTable, "Schneidernew" Import_Schneider_Exit: Exit Sub Import_Schneider_Err: Ms...

Book1.xls virus problem
Dear Fellows, I am having a problem when i open one of my Excel files and through AVG antivirus it is detected with name "XF/Sic" macro virus and i m unable to clean it... Kindly help me to resolve the problem. Regards, Muhammad Alam --- Message posted from http://www.ExcelForum.com/ Hi There is such thing as Google Toolbar. Searching with Google for "XF/Sic", you get a lot of links - the first one will qualify: http://securityresponse.symantec.com/avcenter/venc/data/xf.sic.html -- (When sending e-mail, use address arvil@tarkon.ee) Arvi Laanemets "mm_ala...

Drop down menus problem Win95
Hi, I have sent a spreadsheet to 10 work colleagues, with data dalidation cells (drop down list).. Everyone can read it, except one person. When she opens the file on her computer, the drop down menu does not appear. Her computer is the only one using Win95. Is iy possible that this is the problem? She even tried opening that file on her home computer, with the same problem, and funny enough she runs Win95. Funny coincidence? I'm not sure, but I beleive she is using Excel 97. Thanks in advance for any input/solution Andr´┐Ż If you have freeze panes under window and data>valida...

Insert function
The Insert Ribbon will not open,just the Header/Footer portion will. I can not select Lines I have put in my document, to adjust them. Why?? You say Insert "Ribbon". Are you using Excel 2007? Maybe the sheet is protected. -- -Brigette "Kevin" wrote: > The Insert Ribbon will not open,just the Header/Footer portion will. I can > not select Lines I have put in my document, to adjust them. > Why?? ...

Stationery problem ...
Hi, for a few weeks now we are getting 'Unable to preview selevted stationery, or no stationery selected' when we try and setup stationery in Outlook 2002 (and Exchange Server 2003). any help would be most apprecieted. Thanks. ...

Problems importing customizations
Hi, I'm having difficulties with the import of customizations to a new CRM. I keep getting one of two messages, "SQL Server error occurred" or "Either the file could not be upload or import failed". The customizations file conforms with the schema, and it's size is 5.97MB. Could it be because of the amount of customizations? I have at least 70 custom entities, some of them heavily customized. Do I have to import the entities in groups of related entities? Is the substitution of the new CRM databases with the customized ones, a possible solution? Are there an...

query problem 12-01-09
I've got a table of Organizations and a table of Memberships. Memberships have an OrgID and one Org can be part of many Memberships. Memberships have an expiration date. I'm trying to build a list of Organizations that have at least one non- expired Membership associated with it. I'd like each current Org to show once in a list (for an unbound combo box). I tried: SELECT tblOrganizations.OrganizationID, tblOrganizations.Name, [tblMemberships.Anniversary]>(Date()-60) AS [Current] FROM tblOrganizations INNER JOIN tblMemberships ON tblOrganizations.OrganizationID ...

problem using pst files with Exchange 2003 Standard
Hi, I am having problem using old Pst files when installing new Exchage 2003 Server. Every one in my organization worked in POP3 with pst files , (Outlook 2000/XP) without any difficults. Now, After I have installed Exchange 2003 Standard Edition, and I moved their old emails trough the pst files into the new Exchange Mailbox, I am having Problem reading those mails. I have moved them using the Outlook Drug and Drop feature or even Import/Export Sometimes. Now, those emails are there, but I just can`t use them. They are become unavailable (Gray Color). Please, help find a solution for th...

Problem wih Code
I have the code below which simply just copies rows 18:21 to 9 ranges below it. My sheet is protected with the word FIELD. Everytime I run the macro I get an error "Paste Method Worksheet Class Failed", when I debug it highlights the line "ActiveSheet.Paste" - the first instance of this line. Can anyone assist? Thanks Sub CopyCells() Sheets("Report").Select ActiveSheet.Unprotect Password:="FIELD" ClearCells ActiveSheet.Unprotect Password:="FIELD" Sheets("Report").Select Rows("18:21").Select...

Problem with copying a to from date to another cell
I am trying to enter the first 7 days of the year in one cell. ie: A1 -> 1/2/05 to 1/8/05 And then I want to drag that down to 53 cells and have it copy in the following format. ie: A2 -> 1/9/05 to 1/15/05 A3 -> 1/16/05 to 1/22/05 etc... Is this possible? I would do it by using two separate columns, typing in the two top row dates, the highlight the area you wish to fill, then Edit > Fill > Series > Trend..........then when you have the two columns of dates, use a third helper column with this formula copied down...... =TEXT(A1,"mm/dd/yy")&...