Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old November 22nd, 2007, 12:30 PM
hilladamus hilladamus is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2007
Posts: 1 hilladamus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 32 m 31 sec
Reputation Power: 0
Angry Large Access (VB) Query

Hi all, I've hit a roadblock with this code. I can't get the query to run. The Error that continues to pop up for this code is "Runtime error 3142 - Characters found at end of SQL statement". Debugger lands on ****Set qdf line near the bottom.

I've scoured the web for a solution with no success. I've deleted/added the semicolon at the end which ends up in yet another error.

PLEASE HELP!
Hilladamus

Code:
strSQL = "SELECT [Event Date], [Start Time], [Event Length min], [Origin Bank A1], " & _
    "[Origin Bank A2], [Origin Participant A1], [Origin Participant A2], [Origin Participant A3], " & _
    "[Origin PCSS A1], [Origin PCSS A2], [Origin Other], [Type of Problem Process A1], " & _
    "[Type of Problem Process A2], [Type of Problem Human A1], [Type of Problem Human A2], [Type of Problem External A1], " & _
    "[Type of Problem Systems A1], [Type of Problem Systems A2], [Type of Problem Systems A3], [Impact on Source Miscellaneous A1], " & _
    "[Impact on Source Miscellaneous A2], [Impact on Source Payments Delayed A1], [Impact on Source Payments Delayed A2], [Impact on Source Fund Management Delayed], " & _
    "[Impact on Source Advance], [Who Affected BOC A1], [Who Affected BOC A2], [Who Affected BOC A3], " & _
    "[Who Affected Participant A1], [Who Affected Participant A2], [Who Affected Participant A3], [Who Affected Participant A4]," & _
    "[Who Affected Participant A5], [Who Affected Participant A6], [Who Affected Participant A7], [Who Affected Participant A8]," & _
    "[Who Affected Participant A9], [Who Affected PCSS A1], [Who Affected PCSS A2], [Who Affected Others A1], " & _
    "[Who Affected Others A2], [Impact on affected operations A1], [Impact on affected operations A2], [Impact on affected Payments Delayed A1], " & _
    "[Impact on affected Payments Delayed A2], [Impact on affected Payments Delayed A3], [Impact on affected Fund Management], [Impact on affected Advances], " & _
    "[Consequences A1], [Consequences A2], LVTS_Operationl_Event_Database.[Consequences A3], [Consequences A4], " & _
    "[Consequences A5], [Action Taken by B andor C A1], [Action Taken by B andor C A2], [Action Taken by B andor C A3], " & _
    "[Implemented Contingency on Which System], [Actual Severity of the OE], [Potentially affected BOC A1], [Potentially affected B A2], " & _
    "[Potentially affected B A3], [Potentially affected B A4], [Potentially Affected Participant A1], [Potentially Affected Participant A2], " & _
    "[Potentially Affected Participant A3], [Potentially Affected Participant A4], LVTS_Opeational_Event_Database.[Potentially Affected Participant A5], [Potentially Affected Participant A6], " & _
    "[Potentially Affected Participant A7], [Potentially Affected Participant A8], [Potentially Affected Participant A9], [Potentially Affected PCSS A1], " & _
    "[Potentially Affected PCSS A2], [Potentially Affected PCSS A3], [Potentially Affected PCSS A4], [Potentially Affected PCSS A5], " & _
    "[Potentially Affected PCSS A6], [Potentially Affected Others], [Potential Impact from the OE A1], [Potential Impact from the OE A2], " & _
    "[Potential Impact on Payment Delayed A1], [Potential Impact on Payment Delayed A2], [Potential Impact on Payment Delayed A3], [Potential Impact on Payment Delayed A4], " & _
    "[Potential Impact on Funds Management A1], [Potential Impact on Funds Management A2], [Potential Impact on Advances], [Potential Severity of the OE], " & _
    "[Follow up informations and References A1], [Follow up informations and References A2], [Follow up informations and References A3], [Follow up informations and References A4], " & _
    "[Follow up informations and References A5], [File Status] FROM tb_LVTS_Operational_Event_Database;"
   
    strOrder = "ORDER BY tb_LVTS_Operational_Event_Database.[Date], tb_LVTS_Operational_Event_Database.[Start Time], " & _
               "tb_LVTS_Operational_Event_Database.[Event Length];"
               
    strSQL = strSQL & strWhere & strOrder
    
    'MsgBox "strSQL"
    
    
    '********************
    
    'Use to display the SQL string prior to running the query
    'MsgBox strSQL
    
    'Create a new query
    Dim qdf As QueryDef
    Dim strQueryToRun As String
    strQueryToRun = "NewQuery"
    
    'Delete old query if one exists
    For Each qdf In CurrentDb.QueryDefs
        If qdf.Name = strQueryToRun Then
         CurrentDb.QueryDefs.Delete qdf.Name
        Else
        End If
    Next qdf
        
    'Run the new query
    With CurrentDb
****Set qdf = .CreateQueryDef(strQueryToRun, strSQL)
        DoCmd.OpenQuery qdf.Name
        '.QueryDefs.Delete qdf.Name
    End With
    
    Set qdf = Nothing

End Sub

Last edited by jmurrayhead : November 27th, 2007 at 11:22 AM. Reason: added [code][/code] tags

Reply With Quote
  #2  
Old November 27th, 2007, 11:26 AM
jmurrayhead jmurrayhead is offline
Moderator
ASP Free God 17th Plane (13000 - 13499 posts)
 
Join Date: Feb 2004
Location: Reston, VA, USA
Posts: 13,091 jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)  Folding Points: 88298 Folding Title: Advanced FolderFolding Points: 88298 Folding Title: Advanced FolderFolding Points: 88298 Folding Title: Advanced FolderFolding Points: 88298 Folding Title: Advanced FolderFolding Points: 88298 Folding Title: Advanced Folder
Time spent in forums: 3 Months 1 Week 11 h 23 m 46 sec
Reputation Power: 1580
Is this all done within Microsoft Access, or do you have a Visual Basic application communicating with an Access database?

As to your problem, try removing the semi-colon from this line:

Code:
"[Follow up informations and References A5], [File Status] FROM tb_LVTS_Operational_Event_Database;"


When you concatenate this (strSQL) with strWhere and strOrder, you're actually creating separate queries by having the semi-colon (which Access doesn't support anyway). Your final SQL output should have only one semi-colon at the end (your strOrder would be the correct place to have it).
__________________
jmurrayhead

Did I help you out? Make me popular by clicking the icon!

New Members:Proper way to post a question

Powered by ASP.Net

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Large Access (VB) Query


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT