Error 3131 Syntax Error In From Clause
Contents |
Forum Visual Basic Programming Visual Basic 6.0 Programming [RESOLVED] VB6 - Run-Time error 3131-Syntax error in FROM syntax error in from clause union query clause If this is your first visit, be sure to check out syntax error in from clause excel the FAQ by clicking the link above. You may have to register or Login before you can syntax error in from clause access post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 6 of syntax error in from clause vba 6 Thread: [RESOLVED] VB6 - Run-Time error 3131-Syntax error in FROM clause Tweet Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode January 18th, 2008,09:32 AM #1 Giftx View Profile View Forum Posts Member Join Date Jul 2007 Posts 51 [RESOLVED] VB6 -
Syntax Error In From Clause Access 2010
Run-Time error 3131-Syntax error in FROM clause Hello members, I am trying to execute the module below (SQL statement) and I am getting the above error: "Syntax error in FROM clause" on this line Code: Call db.Execute(strSQL) . When I hovered the mouse over the SQL string variable, it shows this line of code: Code: strSQL = "Insert Into TblProgrammersHours (ProjectID,ProgrammerInitials, CurrProgHrs, PrevProgHrs, TotalProgHrs, Positions) Select * From (" and I can't figure out what the problem is. Any ideas, please? See my entire module below: Thanks. Giftx. Code: Re: VB6 - Create mew table using input from two other tables Dim Db As Database Dim DbPath As String Dim DbName As String Dim strSQL As String Dim rsOutfile As Recordset DbPath = "\\515opsisdallf00008\SHARED\PyrlApps\PTStest2\" 'DbPath = "C:\" DbName = "PTS.mdb" Set Db = OpenDatabase(DbPath & DbName) strSQL = "Insert Into TblProgrammersHours (ProjectID,ProgrammerInitials, CurrProgHrs, PrevProgHrs, TotalProgHrs, Positions) Select * From (" strSQL = strSQL & "Select TblRequests.ProjectID, TblPersonnel.Initials, TblRequests.Prog1hrs, TblRequests.PrevProg1Hrs, TblRequests.TotalProg1hrs, 1 As Position " _ & "From TblRequests Inner Join tblPersonnel
Search Community Links Social Groups Pictures & Albums Members List Calendar Search Forums Show Threads Show Posts Tag Search Advanced Search Find All Thanked Posts Go to Page... Thread Tools Rating: Display Modes 02-04-2007, 02:12 PM
Syntax Error In From Clause Vb6
#1 manix Newly Registered User Join Date: Nov 2006 Location: Hampshire, UK Posts: 100 syntax error in from clause in c# Thanks: 5 Thanked 0 Times in 0 Posts Run TIme Error 3131 - Syntax error in From Clause Hi All, First off just let me thank gromit for posting the search form example in the sample database forum. I have used this to try and create my own little search form so I can query a table of data. But I keep http://forums.codeguru.com/showthread.php?443945-RESOLVED-VB6-Run-Time-error-3131-Syntax-error-in-FROM-clause getting the run time error 3131. There is an issue with my FROM clause. I am using the following code: Code: Private Sub btnSearch_Click() ' Update the record source Me.frmsubToolData.Form.RecordSource = "SELECT * FROM qryTooldata2 " & BuildFilter ' Requery the subform Me.frmsubToolData.Requery End Sub Private Sub Form_Load() ' Clear the search form btnClear_Click End Sub Private Function BuildFilter() As Variant Dim varWhere As Variant Dim varItem As Variant Dim intIndex As Integer varWhere = Null ' Main http://www.access-programmers.co.uk/forums/showthread.php?t=122389 filter ' Check for ST Number If Me.cmbSTno > "" Then varWhere = varWhere & "[ST Order Number] = " & Me.cmbSTno & " AND " End If ' Check for Project Number If Me.TextProject > 0 Then varWhere = varWhere & "[Related to Project Number] = " & Me.TextProject & " AND " End If ' Check for Tool Status If Me.cmbstatus > "" Then varWhere = varWhere & "[Tool Status] = " & Me.cmbstatus & " AND " End If ' Check for Tool Type If Me.cmbtype > 0 Then varWhere = varWhere & "[Tool Type] = " & Me.cmbtype & " AND " End If ' Check for Tool Location If Me.cmblocation > 0 Then varWhere = varWhere & "[Tool Location] = " & Me.cmblocation & " AND " End If ' Check for LIKE Country If Me.Textcountry > "" Then varWhere = varWhere & "[FirstName] LIKE """ & Me.Textcountry & "*"" AND " End If BuildFilter = varWhere End Function Can anyone see where things might be going wrong? As always, thanks to anyone who can help! manix View Public Profile Find More Posts by manix 02-04-2007, 02:40 PM #2 MarkK Super Moderator Join Date: Mar 2004 Location: Vancouver BC Posts: 6,348 Thanks: 4 Thanked 931 Times in 891 Posts I don't see that the string "WHERE " is ever added to
Join INTELLIGENT WORK FORUMSFOR COMPUTER PROFESSIONALS Log In Come Join Us! Are you aComputer / IT professional?Join Tek-Tips Forums! Talk With Other Members Be Notified Of ResponsesTo Your http://www.tek-tips.com/viewthread.cfm?qid=718832 Posts Keyword Search One-Click Access To YourFavorite Forums Automated SignaturesOn Your Posts Best http://forums.devx.com/showthread.php?143781-Run-time-error-3131-Syntax-error-in-FROM-clause Of All, It's Free! Join Us! *Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail. Posting Guidelines Promoting, selling, recruiting, coursework and thesis posting is forbidden.Tek-Tips Posting Policies Jobs Jobs from Indeed What: Where: jobs by Link To This Forum! Add Stickiness To syntax error Your Site By Linking To This Professionally Managed Technical Forum.Just copy and paste the BBCode HTML Markdown MediaWiki reStructuredText code below into your site. Microsoft: Access Modules (VBA Coding) Forum at Tek-Tips HomeForumsProgrammersDBMS PackagesMicrosoft: Access Modules (VBA Coding) Forum Run time error '3131' Syntax error in FROM clause thread705-718832 Forum Search FAQs Links MVPs Run time error '3131' Syntax error in syntax error in FROM clause Run time error '3131' Syntax error in FROM clause uscitizen (TechnicalUser) (OP) 1 Dec 03 10:46 hi -i just got this message in the course of testing some data entry this morning when trying to enter the first control's data in a child sub-form.i'll paste the code with the offending line below:Private Sub Medication_AfterUpdate()'Get data from previous recordDim dbs As Database, rs As Recordset, strSQL As StringSet dbs = CurrentDbstrSQL = "SELECT * FROM [Forms]![Protocol Medications]"strSQL = strSQL & " WHERE [Forms]![Treatment and Toxicity]![Patient Number] = " & Me.[Patient Number]strSQL = strSQL & " AND [Forms]![Treatment and Toxicity]![Cycle] = " & Me.Cycle - 1Set rs = dbs.OpenRecordset(strSQL)If rs.RecordCount = 0 Then Exit Subrs.MoveFirstIf IsNull(rs![Date_ended]) ThenMe.Date_begun = rs![Date_begun]Me.Route = rs!RouteMe.Dose_Unit = rs![Dose_Unit]Me.Dose = rs!DoseMe.[Doses Given] = rs![Doses Given]Me.Doses_Required = rs![Doses_Required]Me.Doses_Missed = rs![Doses_Missed]Me.Dosage_Frequency = rs![Dosage_Frequency]End Ifrs.CloseSet dbs = NothingEnd Subthe line having Set rs = dbs.OpenRecordset(strSQL)was the one the debugger displayed in reverse (yellow) highlighted video.although i have been developing this database for some time, and tested data entry in this form, i haven't seen this error message before. scratching my head (as any newbie would)
Run-time error '3131': Syntax error in FROM clause If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 7 of 7 Thread: Run-time error '3131': Syntax error in FROM clause Tweet Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 05-30-2005,06:55 PM #1 stubin View Profile View Forum Posts Registered User Join Date May 2005 Posts 4 Run-time error '3131': Syntax error in FROM clause Hi I hope someone can help me. When using the "Find Matches" button I have on a form I use to collect criteria from 2 combo boxes the following error message appears. Run-time error '3131': Syntax error in FROM clause The Debug button takes me to the code below. Set qdfAction = db.CreateQueryDef("", sSQL) The code for the relevant function is shown below. I cannot see where I have gone wrong and any help would be appreciated. Thanks. Public Function BuildResultsTable(sSQL As String, sTableName As String, lRecordsAffected As Long) Dim db As database Dim qdfAction As querydef Set db = CurrentDb On Error Resume Next db.TableDefs.Delete sTableName On Error GoTo 0 sSQL = Replace(sSQL, " FROM ", " INTO " & sTableName & " FROM ") Set qdfAction = db.CreateQueryDef("", sSQL) qdfAction.Execute dbFailOnError lRecordsAffected = qdfAction.RecordsAffected qdfAction.Close BuildResultsTable = True End Function Reply With Quote 05-30-2005,08:12 PM #2 Phil Weber View Profile View Forum Posts Visit Homepage Senior Member Join Date Nov 2003 Location Portland, OR Posts 8,387 What is the value of sSQL when you get the error? What res