Winsock, Syntax Error...
I'm trying to connect to a ftp server with the winsock control.
I have setup the winsock controls remote hsot and port.
The data arrival event puts the data recived in a text box. I see that the ftp server wants the username.
I have another text box where I can enter commands to send with the senddata method of the winsock control. But when I try to send the Username to the ftp server, all I get back is "500 Syntax error, Command not recognized".
I have tried to use USER *****, and only ******. I also have tried to add vbcrlf after the string to be sent. I have tried to add vbcrlf before the string to be sent...
What are I doing wrong???
/Smirre
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Winsock Syntax? (To Request A Website With The Winsock Control)
Ok, I don't know very much about Winsock and am just now starting to use it. I'm making an anonymity program that modifies referer and user agent data. I managed to find an example of how its done on planetsourcecode.com but there's a few things that aren't working.
Anyway, when this string is sent, it sends the headers and a request for index.html from the connected host (winsock1.connect domain.com 80).
GET index.html HTTP/1.0
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-comet, */*
Accept-Language: en
Accept-Encoding: gzip , deflate
Cache-Control: no-cache
Proxy-Connection: Keep-Alive
User-Agent: Whatever
Referer: www.whatever.com
But when I used the website http://ipid.shat.net/ as the domain to see if code mdified the headers or not, it directed me instead to just www.shat.net. How would a browser request information to ipid.shat.net?
Also, I noticed that by sending just that information, cookies don't work properly. What other tags do I have to add onto that for it to recieve my session information? Thanks a lot.
Winsock Syntax
I am working on a VB 6 app that will communicate with a third party server control. The server control wants inforamtion posted to it in the following format.
http://SQL200:1000/cgi-bin/auth.cgi?ya_da_ya_da_ya
sql2000 = local server's name
"ya_da_ya_da_ya" = information to be posted.
I have used the VB winsock control in my app to connect to the server and send the information.
Winsock1.Protocol = sckTCPProtocol
Winsock1.Connect "10.0.0.113", "1000"
Winsock1.SendData "ya_da_ya_da_ya"
I have confirmed these three lines of code successfully connect to the server app and send the information. However, since I did not incluce the location of "cgi-bin/auth.cgi", the server does not reply.
How do I connect to the location "cgi-bin/auth.cgi"?
I have tried numerous combinations but they are all just guesses. I do not know how or where to put the "cgi-bin/auth.cgi" in the connect statement.
When I open a browser on the sql2000 machine and type in:
http://localhost:1000/cgi-bin/auth.cgi?ya_da_ya_da_ya, the server responds with the correct information.
I am trying to create a winsock control that that sends this data and listens for the response.
Thanks,
pat
Using A Seperator With Winsock (syntax)
Hi all, im curious to know how i can accomplish something like this...
winsock1 sends data with 4 seperate items. (item1|item2|item3|item4)
how can i setup a way to seperate them like that
winsock2 (server) received the data string and pulles the items apart. and puts them where they need to be. and sends the result back to the clients.
Thanks
Winsock.remotehost Syntax Problem
hi
I have had Winsock going before , but now I can seem to enter the
.RemoteHost name properly
What is the format for the name?
ie. username.ispname.co.nz
username@ispname.co.nz or what?
I get error # 11004 when I do a .Connect , indicating the host was not found.
(I have a ADSL connection made (email program works).)
I have tried to connect using 'open' command in TelNet in DOS,
but same result.
VB 6 - Run-Time Error 3075 Syntax Error (Missing Operator) In Query Expression
Hi all
sorry for the inconveniences, I just wanna get this syntax thing out of my back.
I modified my vb module and now I'm getting "Run-Time error 3075 syntax error(Missing operator) - query expression"
Then it displayed this line of code as the problem line:
Code:
'TblPersonnel.[Name] = TblRequests.Personnel1 Union All
Select TblRequests.ProjectID'.
Below is the complete module:
Code:
DbPath = "\515opsisdallf00008SHAREDPyrlAppsPTStest2"
DbName = "PTS.mdb"
Set Db = OpenDatabase(DbPath & DbName)
strSQL = "Insert Into TblProgrammersHours (ProjectID,ProgrammerInitials, CurrProgHrs, PrevProgHrs, TotalProgHrs, Positions)"
strSQL = strSQL & " Select TblRequests.ProjectID, TblPersonnel.Initials, TblRequests.Prog1hrs, TblRequests.PrevProg1Hrs, TblRequests.TotalProg1hrs, 1 As Position " _
& "From TblRequests Inner Join tblPersonnel On TblPersonnel.[Name] = TblRequests.Personnel1 "
strSQL = strSQL & "Union All " _
& " Select TblRequests.ProjectID, TblPersonnel.Initials, TblRequests.Prog2hrs, TblRequests.PrevProg2Hrs, TblRequests.TotalProg2hrs, 2 " _
& "From TblRequests Inner Join tblPersonnel On TblPersonnel.[Name] = TblRequests.Personnel2 "
strSQL = strSQL & "Union All " _
& " Select TblRequests.ProjectID, TblPersonnel.Initials, TblRequests.Prog3hrs, TblRequests.PrevProg3Hrs, TblRequests.TotalProg3hrs, 3 " _
& "From TblRequests Inner Join tblPersonnel On TblPersonnel.[Name] = TblRequests.Personnel3 "
strSQL = strSQL & "Union All " _
& " Select TblRequests.ProjectID, TblPersonnel.Initials, TblRequests.Prog4hrs, TblRequests.PrevProg4Hrs, TblRequests.TotalProg4hrs, 4 " _
& "From TblRequests Inner Join tblPersonnel On TblPersonnel.[Name] = TblRequests.Personnel4 "
strSQL = strSQL & "Union All " _
& " Select TblRequests.ProjectID, TblPersonnel.Initials, TblRequests.Prog5hrs, TblRequests.PrevProg5Hrs, TblRequests.TotalProg5hrs, 5 " _
& "From TblRequests Inner Join tblPersonnel On TblPersonnel.[Name] = TblRequests.Personnel5 "
strSQL = strSQL & "Union All " _
& " Select TblRequests.ProjectID, TblPersonnel.Initials, TblRequests.Prog6hrs, TblRequests.PrevProg6Hrs, TblRequests.TotalProg6hrs, 6 " _
& "From TblRequests Inner Join tblPersonnel On TblPersonnel.[Name] = TblRequests.Personnel6 "
strSQL = strSQL & ") As NewProgHrsTbl"
Call Db.Execute(strSQL)
Thanks.
tgifgemini
RunTime Error 3075 - Syntax Error (Missing Operator) In Query Operession
Hi all
sorry for the inconveniences, I just wanna get this syntax thing out of my back.
I modified my vb module and now I'm getting "Run-Time error 3075 syntax error(Missing operator) - query expression"
Then it displayed this line of code as the problem line:
Code:
'TblPersonnel.[Name] = TblRequests.Personnel1 Union All
Select TblRequests.ProjectID'. <==== Error occurs here
I can't seem to figure out why my SQL statement is bumming out on the above line.
Below is my complete module:
Code:
DbPath = "\515opsisdallf00008SHAREDPyrlAppsPTStest2"
DbName = "PTS.mdb"
Set Db = OpenDatabase(DbPath & DbName)
strSQL = "Insert Into TblProgrammersHours (ProjectID,ProgrammerInitials, CurrProgHrs, PrevProgHrs, TotalProgHrs, Positions)"
strSQL = strSQL & " Select TblRequests.ProjectID, TblPersonnel.Initials, TblRequests.Prog1hrs, TblRequests.PrevProg1Hrs, TblRequests.TotalProg1hrs, 1 As Position " _
& "From TblRequests Inner Join tblPersonnel On TblPersonnel.[Name] = TblRequests.Personnel1 "
strSQL = strSQL & "Union All " _
& " Select TblRequests.ProjectID, TblPersonnel.Initials, TblRequests.Prog2hrs, TblRequests.PrevProg2Hrs, TblRequests.TotalProg2hrs, 2 " _
& "From TblRequests Inner Join tblPersonnel On TblPersonnel.[Name] = TblRequests.Personnel2 "
strSQL = strSQL & "Union All " _
& " Select TblRequests.ProjectID, TblPersonnel.Initials, TblRequests.Prog3hrs, TblRequests.PrevProg3Hrs, TblRequests.TotalProg3hrs, 3 " _
& "From TblRequests Inner Join tblPersonnel On TblPersonnel.[Name] = TblRequests.Personnel3 "
strSQL = strSQL & "Union All " _
& " Select TblRequests.ProjectID, TblPersonnel.Initials, TblRequests.Prog4hrs, TblRequests.PrevProg4Hrs, TblRequests.TotalProg4hrs, 4 " _
& "From TblRequests Inner Join tblPersonnel On TblPersonnel.[Name] = TblRequests.Personnel4 "
strSQL = strSQL & "Union All " _
& " Select TblRequests.ProjectID, TblPersonnel.Initials, TblRequests.Prog5hrs, TblRequests.PrevProg5Hrs, TblRequests.TotalProg5hrs, 5 " _
& "From TblRequests Inner Join tblPersonnel On TblPersonnel.[Name] = TblRequests.Personnel5 "
strSQL = strSQL & "Union All " _
& " Select TblRequests.ProjectID, TblPersonnel.Initials, TblRequests.Prog6hrs, TblRequests.PrevProg6Hrs, TblRequests.TotalProg6hrs, 6 " _
& "From TblRequests Inner Join tblPersonnel On TblPersonnel.[Name] = TblRequests.Personnel6 "
strSQL = strSQL & ") As NewProgHrsTbl"
Call Db.Execute(strSQL)
Thanks.
giftx
SQL7 Stored Procedure Error: Syntax Error Or Access Violation
Using VB6 SP5, ADO 2.7, Sql7 SP4.
When I try to execute any stored procedure I get the error:
Run-time error '-2147217900 (80040e14)':
Syntax error or access violation
Dim cAck As ADODB.Command, cParam As ADODB.Parameter
Set cAck = New ADODB.Command
cAck.name = "sp_Test1"
cAck.CommandType = adCmdStoredProc
cAck.ActiveConnection = oCon
cAck.Execute
oCon is connection that is made prior and specifies the inital catalog. I can do anything else using this including views and update queries but when I try to access any stored procedure I get the above error. I even scaled back to a simple stored procedure that does nothing and get the same error.
Truely lost on this one.
-J
Getting A Run-time Error '3134' Syntax Error In INSERT INTO Statement
Code:
Private Sub cmdMass_Click()
Dim db As Database
Dim rs As Recordset
Dim datHold As Date
Dim datStart As Date
Dim datEnd As Date
Dim intID As Integer
Dim strSQL As String
Set db = CurrentDb
Set rs = db.OpenRecordset("qryEmployeeIDs") 'gets unique IDs
rs.MoveFirst
datHold = #12/30/2000#
datStart = datHold
Do While Not rs.EOF
Do While datEnd < #4/1/2006#
datEnd = DateAdd("d", datStart, 13)
intID = rs![Employee_ID]
DoCmd.SetWarnings False
strSQL = "Insert tblSick_Leave(Employee_ID, Pay_Period_StartDate, Pay_Period_EndDate,
Begining_Balance_Hours, Begining_Balance_Minutes, Earned_Hours,
Earned_Minutes, Used_Sick_Hours, Used_Sick_Minutes,
Ending_Balance_Hours, Ending_Balance_Minutes) Values ('" & intID & "', #" &
datStart & "#, #" & datEnd & "#, '0', '0', '0', '0', '0', '0', '0', '0')"
datStart = DateAdd("d", datStart, 14)
Loop
rs.MoveNext
Loop
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
DoCmd.SetWarnings True
End Sub
First, allow me to say that I have broken the statement down to multiple lines for readability issues here. Basically, what I want it to do is insert the date ranges for previous pay periods into the table or each employee as well as entering 0 into the record for each other field in the table. I am having a few issues with that as I am getting this error and I have tried everything to get it to work, but I keep getting this runtime error. Any thoughts on this?
SQL Error ODBC Visual FoxPro Driver: Syntax Error
Can somebody tell me what is wrong about the query (bold) and a solution for it?
VB Code:
Public cn As New ADODB.ConnectionPublic rs As New ADODB.RecordsetPublic cn2 As New ADODB.ConnectionPublic rs2 As New ADODB.Recordset Private Sub cmdOpenBron_Click() Dim naam As String Set cn = New ADODB.Connection cn.Open "Driver={Microsoft Visual FoxPro Driver};" & _ "SourceType=DBC;" & _ "SourceDB=J:BjornDatadubois.dbc;" & _ "Exclusive=No" Set rs = cn.Execute("Select * from KLPX") Set cn2 = New ADODB.Connection cn2.Open "Driver={Microsoft Visual FoxPro Driver};" & _ "SourceType=DBF;" & _ "SourceDB=C:WINBOOKSdataParfiNV;" & _ "Exclusive=No" Set rs2 = cn2.Execute("Select * FROM PARFINV_csf") While Not rs.EOF While Not rs2.EOF If Not rs![KL_NAM] = rs2![NAME1] Then naam = rs![KL_NAM] [b]cn2.Execute "INSERT INTO PARFINV_csf [(NAME1)] VALUES '" & naam & "'"[/b] End If Wend Wend cn.Close Set rs = Nothing Set cn = Nothing cn2.Close Set rs2 = Nothing Set cn2 = Nothing
Thanx alot in advance
ERROR 3077 : Syntax Error (Missing Operator) In Expression
Hi,
I am trying to use the "Findfirst" method to locate records in my database.
However, the command just raises the Runtime error 3077
please help!!!!!!!!!!
I've inserted the code below!
Code:Private Sub commloadform_Click()
Dim testno As String
DataList.Recordset.MoveFirst
Do While Not DataList.Recordset.EOF
DialogWhichTest!TestNoCombo.AddItem (DataList.Recordset.Fields("Job Number").Value)
DataList.Recordset.MoveNext
Loop
DialogWhichTest.Show vbModal, FormICS2000
testno = TestNumberForICS2000
If testno = "" Then
Exit Sub
End If
findtest = "Job Number = '" & CStr(testno) & "'"
DataList.Recordset.FindFirst (findtest)
Call UpdateDisplay
End Sub
RunTime Error 3134 Syntax Error In INSERT INTO
I have gone over and over this and cannot find the issue with this code can anybody help me?
Dim StrSql As String
StrSql = "INSERT INTO [Customer Table] ([Customer ID], [First Name], [Last Name], [Company Name], [Main Phone], [Alt Phone], [Address]) SELECT " & [Customer ID] & " As [Customer ID], " & [First Name] & " As [First Name] , " & [Last Name] & " AS [Last Name], " & [Company Name] & " AS [Company Name], " & [Main Phone] & " AS [Main Phone], " & [Alt Phone] & " AS [Alt Phone], " & [Address] & " AS [Address];"
DoCmd.RunSQL (StrSql)
SQL Statment And VB6 Issues - Help Please, Error: Syntax Error In FROM Clause.
I have created a query in MS access that gives me a percentage of 2 "Count" values from other queries. I'm using an ADO control with ODBC to connect to my DB. Well, when I try to point the record source to the query I've made it gives me the following error:
[Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.
Here is my SQL query:
SELECT [qry1]![calls]/[qry2]![CountOfCallID] AS count2
FROM qry1, qry2;
Here is my Access query:
count2: [qry1]![calls]/[qry2]![CountOfCallID]
Qry1 is as follows:
SELECT Count(Calls.CallID) AS calls
FROM Calls
WHERE (((Calls.TimeTaken)=[Time]) AND ((Calls.Date)=Date()) AND ((Calls.DateReceived)=[calls]![datetaken]));
Calls is the only table I’m working with and TimeTaken is a column and so on..
Qry2 is as follows:
SELECT Count(Calls.CallID) AS CountOfCallID
FROM Calls
GROUP BY Calls.Date
HAVING (((Calls.Date)=Date()));
These query’s give me a total count of records in 2 diff query’s displayed in one field so that I could divide them and get my percentage. These I can get to display on my labels with no errors.
The percentage query is again:
SELECT [qry1]![calls]/[qry2]![CountOfCallID] AS count2
FROM qry1, qry2;
I have a feeling it has something to do with qry1 and qry2 which only display the count of another query. I've then divided them and multiplied the result to get my percentage which is all that’s displayed in the above query. I'm trying to display this percentage in a label in VB6. I am able to display the count queries in a label in VB but not the percentage.
I'm a newbie with VB6 so am not sure how to proceed. I've tried to select the query in the RecordSource, also tried to input the SQL query in the RecordSource but nothing seems to work. BTW the query works great in Access with no errors.
Any help would be greatly appreciated.
Thanks,
Wyatt
VB Error: Syntax Error Or Access Violation
I am getting the Syntax Error or Access Violation when I attempt to run my program. I have an idea as to what the problem is but can't figure out how to fix it.
I am using the command object to execute a stored procedure that has 4 input parameters and 2 output parameters.
Here is my code:
Code:
Call CrossingFiles 'Calls function
Application.ActiveWorkbook.Save
Application.DisplayAlerts = False
Application.ActiveWorkbook.Close
Set MyXL = Nothing
Unload OpenFile
ErrorHandler: ' Error-handling routine.
Dim StrErr As String
StrErr = Err.Number & " - " & Err.Description
If Err = 364 Then
Exit Sub
End If
MsgBox (StrErr), vbOKOnly, Error
End Sub
Sub CrossingFiles()
Dim wsData As Worksheet
Dim fund As String
Dim trans_type As String
Dim security_id As String
Dim shares As String
Dim strRangeA As String
Dim strRangeB As String
Dim strRangeC As String
Dim strRangeE As String
Dim prmfund As ADODB.Parameter
Dim prmtrans As ADODB.Parameter
Dim prmsec As ADODB.Parameter
Dim prmshare As ADODB.Parameter
Dim prmFlg As ADODB.Parameter
Dim prmErr As ADODB.Parameter
Dim strSQL As String
Dim strDesc As String
Dim cmd As Command
Dim i As Integer
Dim adoConn As ADODB.Connection
Dim rst As New ADODB.Recordset
Dim txtLog As String
Dim flag As String
Dim desc As String
Set wsData = ActiveSheet
Set adoConn = New ADODB.Connection
Set rst = New ADODB.Recordset
Set cmd = New ADODB.Command
i = 1
txtLog = " "
flag = " "
desc = " "
wsData.Rows(1).Delete
adoConn.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=ODBCsrc;Initial Catalog=main"
adoConn.Open
'This will go through the worksheet, row by row, and send the necessary data to the DB
Dim MyColumns_Range As Range
Set MyColumns_Range = Range(wsData.Cells(1, "A"), wsData.Cells(1, "A").End(xlDown))
For Each c In MyColumns_Range
strRangeA = "A" & i
strRangeB = "B" & i
strRangeC = "C" & i
strRangeE = "E" & i
fund = Range(strRangeA).Value
trans_type = Range(strRangeB).Value
security_id = Range(strRangeC).Value
shares = Range(strRangeE).Value
Set cmd.ActiveConnection = adoConn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "Execute stored_proc '" & fund & "', '" & trans_type & "', '" & security_id & "', '" & shares & "', "
'Declare the output parameters
Set prmFlg = cmd.CreateParameter("flg", adVarChar, adParamOutput, 1, "")
cmd.Parameters.Append prmFlg
Set prmErr = cmd.CreateParameter("Err", adVarChar, adParamOutput, 255, "")
cmd.Parameters.Append prmErr
'adoConn.Execute strSQL, , adCmdText
'rst.Open strSQL, adoConn, adOpenStatic, adLockReadOnly
Set rst = cmd.Execute
'strDesc = rst.Fields("flag") & " " & rst.Fields("desc")
strDesc = prmFlg.Value + " " + prmErr.Value
txtLog = txtLog + strDesc
'rst.Close
i = i + 1
fund = " "
trans_type = " "
security_id = " "
shares = " "
strDesc = " "
cmd.CommandText = " "
Set prmFlg = Nothing
Set prmErr = Nothing
Next c
Set wsData = Nothing
adoConn.Close
'saves any changes made to the workbook and turns off the prompts ('are you sure')
Application.DisplayAlerts = False
ActiveWorkbook.Save
Application.DisplayAlerts = True
End Sub
I have a watch set for the cmd.CommandText to see what it is set for (before I get the error). This is what it is set for:
"{ call Execute stored_proc '520150472', 'BUY', '36144810', '700', (?, ?) }"
Note the (?,?). Why are there parantheses and why are there question marks? Even when I type this into SQL I get the same error. Why? What can I do to fix it?
VB Error: Syntax Error Or Access Violation
I am getting the Syntax Error or Access Violation when I attempt to run my program. I have an idea as to what the problem is but can't figure out how to fix it.
I am using the command object to execute a stored procedure that has 4 input parameters and 2 output parameters.
Here is my code:
Call CrossingFiles 'Calls function
Application.ActiveWorkbook.Save
Application.DisplayAlerts = False
Application.ActiveWorkbook.Close
Set MyXL = Nothing
Unload OpenFile
ErrorHandler: ' Error-handling routine.
Dim StrErr As String
StrErr = Err.Number & " - " & Err.Description
If Err = 364 Then
Exit Sub
End If
MsgBox (StrErr), vbOKOnly, Error
End Sub
Sub CrossingFiles()
Dim wsData As Worksheet
Dim fund As String
Dim trans_type As String
Dim security_id As String
Dim shares As String
Dim strRangeA As String
Dim strRangeB As String
Dim strRangeC As String
Dim strRangeE As String
Dim prmfund As ADODB.Parameter
Dim prmtrans As ADODB.Parameter
Dim prmsec As ADODB.Parameter
Dim prmshare As ADODB.Parameter
Dim prmFlg As ADODB.Parameter
Dim prmErr As ADODB.Parameter
Dim strSQL As String
Dim strDesc As String
Dim cmd As Command
Dim i As Integer
Dim adoConn As ADODB.Connection
Dim rst As New ADODB.Recordset
Dim txtLog As String
Dim flag As String
Dim desc As String
Set wsData = ActiveSheet
Set adoConn = New ADODB.Connection
Set rst = New ADODB.Recordset
Set cmd = New ADODB.Command
i = 1
txtLog = " "
flag = " "
desc = " "
wsData.Rows(1).Delete
adoConn.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=ODBCsrc;Initial Catalog=main"
adoConn.Open
'This will go through the worksheet, row by row, and send the necessary data to the DB
Dim MyColumns_Range As Range
Set MyColumns_Range = Range(wsData.Cells(1, "A"), wsData.Cells(1, "A").End(xlDown))
For Each c In MyColumns_Range
strRangeA = "A" & i
strRangeB = "B" & i
strRangeC = "C" & i
strRangeE = "E" & i
fund = Range(strRangeA).Value
trans_type = Range(strRangeB).Value
security_id = Range(strRangeC).Value
shares = Range(strRangeE).Value
Set cmd.ActiveConnection = adoConn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "Execute stored_proc '" & fund & "', '" & trans_type & "', '" & security_id & "', '" & shares & "', "
'Declare the output parameters
Set prmFlg = cmd.CreateParameter("flg", adVarChar, adParamOutput, 1, "")
cmd.Parameters.Append prmFlg
Set prmErr = cmd.CreateParameter("Err", adVarChar, adParamOutput, 255, "")
cmd.Parameters.Append prmErr
'adoConn.Execute strSQL, , adCmdText
'rst.Open strSQL, adoConn, adOpenStatic, adLockReadOnly
Set rst = cmd.Execute
'strDesc = rst.Fields("flag") & " " & rst.Fields("desc")
strDesc = prmFlg.Value + " " + prmErr.Value
txtLog = txtLog + strDesc
'rst.Close
i = i + 1
fund = " "
trans_type = " "
security_id = " "
shares = " "
strDesc = " "
cmd.CommandText = " "
Set prmFlg = Nothing
Set prmErr = Nothing
Next c
Set wsData = Nothing
adoConn.Close
'saves any changes made to the workbook and turns off the prompts ('are you sure')
Application.DisplayAlerts = False
ActiveWorkbook.Save
Application.DisplayAlerts = True
End Sub
I have a watch set for the cmd.CommandText to see what it is set for (before I get the error). This is what it is set for:
"{ call Execute stored_proc '520150472', 'BUY', '36144810', '700', (?, ?) }"
Note the (?,?). Why are there parantheses and why are there question marks? Even when I type this into SQL I get the same error. Why? What can I do to fix it?
Winsock Error (System Lockup Upon Winsock Execution)
Has anyone encountered an issue when running the winsock command and either a .listen or .connect locks up your VB Studio? This is occurring on my system and I'm not sure if its a problem with my current DLL or if I'm just not doing something correctly.
Please help.
Chris, Baltimore.
Compile Error Syntax Error
I posted this one yesterday about the EA in the first line of the code and removed the " before the EA. I tried the macro again and received compile and syntax error? (and the first line is highlighted ending with "Origin". This macro worked before i changed it to have the file open the current day. (first line) since then it hasn't worked. so I change the date manually every day before I run it.
any ideas?
Workbooks.OpenText Filename:="X:xfilessha orhldovrEA" & format(now(), "yymmdd") & ".TXT", Origin
:=437, StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote _
, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False, Comma:= _
True, Space:=False, Other:=True, OtherChar:=")", FieldInfo:=Array(Array _
(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8 _
, 1), Array(9, 1)), TrailingMinusNumbers:=True
ChDir "S:MMCRTorontoHoldover"
Workbooks.Open Filename:="S:MMCRTorontoHoldoverMaster_Holdover.xls", _
UpdateLinks:=0, Origin:=xlWindows
Workbooks.Open Filename:="S:MMCRTorontoHoldoverNAV.xls", UpdateLinks:=0 _
, Origin:=xlWindows
Windows("EA080610.TXT").Activate
Windows("NAV.xls").Activate
Windows("Master_Holdover.xls").Activate
Sheets("Data").Select
Range("A2").Select
Windows("EA080610.TXT").Activate
SQL Error - Syntax Error In UPDATE
I have a table called Currency with 1 text(1) field called symbol.
The SQL I have built in VB is :
"UPDATE currency SET symbol = '$' "
I have tried numerous variations but cant get the blinder to work, it must have something to do with the $ being a special character or something?
Compile Error: Syntax Error
Private Sub Form_Load()
MsgBox "This is a test.", vbYesNoCancel + vbQuestion, "Title"
Dim iRes As Integer
iRes=MsgBox("Test Question?",vbYesNo+vbQuestion,"Title"
If iRes = vbYes Then
MsgBox "The Yes button was clicked."
Else
MsgBox "The No button was clicked."
End If
End Sub
I copied this code off this web site but it crashes. I think I need to put the dim statement somewhere else...???
Please help.
Syntax Error!!!
Hi Friends,
Here is my most updated code and still I have syntax error which says:
Missing (operator) in query expression 'tpoints.coef2 where coef2 < Xmin'
What did I miss that couldn't figure out?
I appriciate your help
Elahe
My query
=======
'Run the query where coef2< Xmin
db.Open "SELECT tPoints.coef2, count(Round(((coef2-Xmin)/dx)- 0.5)) AS n FROM tPoints GROUP BY " & _
"tPoints.coef2 where coef2 < Xmin;", _
CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdText
My code
========
Public Sub Frequency()
Dim strSQL As String
Dim Xmin As Double
Dim Xmax As Double
Dim dx As Double
Dim Average As Double
Dim n As Double
Dim Strmsg As String
Set db = New ADODB.Recordset
db.CursorLocation = adUseClient
'DoCmd.OpenForm "BinNumber"
'Get the Xmin from Coef2
db.Open "SELECT 2-(3*StDev(coef2)) As Xmin FROM tPoints;", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
Xmin = db(0)
Strmsg = Strmsg & " Xmin: " + Format(Xmin, "#.###e-###") + " = " + CStr(Xmin) & vbCrLf
db.Close
'Get the Xmax from Coef2
db.Open "SELECT 2+(3*StDev(coef2)) As Xmax FROM tPoints;", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
Xmax = db(0)
Strmsg = Strmsg & " Xmax: " + Format(Xmax, "#.###e-###") + " = " + CStr(Xmax) & vbCrLf
db.Close
'Get the Average from Coef2
db.Open "SELECT AVG(coef2) FROM tPoints;", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
Average = db(0)
Strmsg = Strmsg & " Average: " + Format(Average, "#.###e-###") + " = " + CStr(Average) & vbCrLf
db.Close
'Get the Standard Deviation from Coef2
db.Open "SELECT StDev(coef2) FROM tpoints;", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
StdDeviation = db(0)
Strmsg = Strmsg & " StdDeviation: " + Format(StdDeviation, "#.###e-###") + " = " + CStr(StdDeviation) & vbCrLf
db.Close
'Get the Bin number through Form,but consider i=5 for now
'Get the dx
db.Open "SELECT AVG(coef2) As avgcoef, StDev(coef2) As stdcoef FROM tpoints;", _
CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdText
dx = (((db!avgcoef + (3 * db!stdcoef)) - (db!avgcoef - (3 * db!stdcoef))) / 5)
Strmsg = Strmsg & " dx = " & Format(dx, "#.###e-###") & "----" & CStr(dx)
db.Close
i = 0
'Run the query where coef2< Xmin
db.Open "SELECT tPoints.coef2, count(Round(((coef2-Xmin)/dx)- 0.5)) AS n FROM tPoints GROUP BY " & _
"tPoints.coef2 where coef2 < Xmin;", _
CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdText
'Insert into the Frequency_table
db.Open "Insert into Frequency_table values(((i + 0.5)*dx),i,n);", _
CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdText
'i is the number of bin between 1 and 4
For i = 1 To 4
'Run the query where Xmin<coef2<Xmax
db.Open "SELECT tPoints.coef2, count(Round(((coef2-Xmin)/dx)- 0.5)) AS n FROM tPoints GROUP " & _
"BY tPoints.coef2 where Xmin<coef2 and coef2<Xmax;", _
CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdText
' db.Open "SELECT tPoints.coef2, Round(((coef2-(select min(coef2) " & _
' " from tPoints ))/(((select max(coef2) from tPoints )-(select min " & _
' "(coef2) from tPoints ))/i))-0.5) AS Rounded FROM tPoints GROUP " & _
' "BY tPoints.coef2 where Xmin<coef2<Xmax;"
'Insert into the Frequency_table
db.Open "Insert into Frequency_table values(((i + 0.5)*dx),i,n);", _
CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdText
Next i
MsgBox Strmsg
i = 5
'Run the query where coef2 > Xmax
db.Open "SELECT tPoints.coef2, count(Round(((coef2-Xmin)/dx)- 0.5)) AS n FROM tPoints GROUP " & _
"BY tPoints.coef2 where coef2 > Xmax;", _
CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdText
'Insert into the Frequency_table
db.Open "Insert into Frequency_table values(((i + 0.5)*dx),i,n);", _
CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdText
End Sub
Possible Syntax Error?
Hey,
I have code that is placed in one workbook and gets data from another based off of the name on the first workbook.
So the steps are:
1) gets the name
2) opens the second workbook
3) moves from the active cell to the next one to the right
4) puts it in a specific cell on the 1st workbook.
Code:
Const wb1 = "3rd Grade Report Card.xls"
Const wb2 = "3rd Grade Data.xls"
Const wb1Path = ""
Sub Update_Info()
Dim nm As String
Dim wb1, wb2 As String
wb1 = "3rd Grade Report Card.xls"
wb2 = "3rd Grade Data.xls"
nm = Sheets(1).Range("G4").Value
Workbooks.Open Filename:= _
"C:Documents and SettingsilaomiDesktop" & wb2
Workbooks(wb2).Sheets(1).Select
Columns("A:A").Select
Selection.Find(What:=nm, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Activate
Workbooks(wb1).Sheets(1).Cells(8, 4).Value = Workbooks(wb2).Sheets(1).Cells(ActiveCell.Offset(0, 1)).Value
for some reason I am getting a type mismatch. It shouldn't matter what I dim the variable as, should it?
I get the error when setting the two cells equals to eachother.
Thanks,
Mike
Syntax Error
Does anyone know what the correct synax for INSERT INTO is for an Excel Spreadsheet? Are spaces, ".", "", etc not allowed? Here's what I'm currently using:
Code:
For q = 1 To 24
strSQL = "INSERT INTO [Sheet1$] (Department, Unit, Suffix, Age, _
InternalExternal, Cluster, Work Status Code, Status Reason Code, Group _
Number, Subscriber, DCN, Received Dated, Payee, Operator ID, Age In _
Status, Section, Provider No., SCCF Number, Home Control Received Date, _
Home Control Age, COB Type, BOB Policy Number, BIS Error Code, Provider _
Number) VALUES ('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', _
'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a')"
UserData.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & App.Path & "IMS Excel" & strType & ".xls;" & "Extended Properties=""Excel 8.0;HDR=YES"";"
UserData.Open
With cmd
.ActiveConnection = UserData
.CommandText = strSQL
.Execute
End With
Next q
I'm just using "a"'s to test with. It doesn't matter what I plug in; it just doesn't work. My sheet is called Sheet1 and the field names are EXACTLY what is in the top row.
Syntax Error
Hallo Hi...
I've a porblem when searching record in database. Vb gave an error message "Syntax Error (missing operator) in expression". It only happen when I search a record that contain single quote sign. Example:
dim strName as string
strName = "Tom's"
rs.FindFirst "Name = '" & strName & "'"
Please help me...
Paul (pwnette) may be can help me
Thank you
Raymond
Syntax Error
Hi, all
I am testing a sample example of a function that returns an array of integers, but I got a sysntax error. why is wrong?
here is the code.
Private Sub Form_Load()
Dim i As Integer
Dim ReturnArray() As Integer
i = 1
ReturnArray() = ArrayFunction(i)
End Sub
Public Function ArrayFunction(i As Integer) As Integer()
Dim x(2) As Integer
x(0) = i
x(1) = i + 1
Exit Function x <----- syntax error
End Function
thanks,
TK
Syntax Error?
I have a button on my program that will load in a certain text, but when pressed, I get a syntax error. Here is the code:
Code:
Private Sub Command2_Click()
Clipboard.SetText ("<p>Zimmer Total Knee System<br><a href="http://www.zimmer.com">Website</a></p><p> </p>")
Text2.Text = Clipboard.GetText()
End Sub
Syntax Error
Code:
Private Sub Form_Load()
Dim Index As Integer
Dim Court As Integer
Dim File As String
Dim Game As GameType
File = App.Path & "CurrentGames.dat"
Open File For Random As #1 Len = Len(Game)
For Court = 1 To Maxtables
Get #1 , Game
If Game.Occupied = "Y" Then
lblCourts(Court).BackColor = RGB(0, 0, 0)
lblCourts(Court).ForeColor = RGB(255, 255, 255)
lblStartingTimes(Court).Caption = bastimefunctions.ShortenTime(Game.StartTime)
End Sub
Apparently the Get #1, Game line is a syntax error, can anyone help me with explaining/correcting the situation please
Syntax Error
Private Sub Button_A_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button_A.Click
Imports System.Data.OleDb
Dim strSQL As String = "Select * From Customers"
Dim Connection As New OleDbConnection (strConnection)
Dim DA As New OleDbDataAdapter(strSQL, Connection)
Dim DS As New DataSet
DA.Fill(DS, "Customers")
dgrdProjects.DataSource = DA
End Sub
Syntax Error
Hi, I have a Sysntax error in my code above: Try to copy and paste. Thanks
Code:
strSQL = "SHAPE {SELECT ID,Apellido,Nombre,Fecha_Nacimiento,Estatura,Peso,Direccion,Telefono,Profecion,Nombre_Empresa,Direccion_Empresa,Medico_Anterior,Referido_por,Motivo_Consulta,Tel_Emergencia1,Nombre_Emergencia1,Nombre_Emergencia2,Tel_Emergencia2,Tipo_Sangre,Ultimo_Tratamiento,Historia_Clinica,Foto,Otros_Datos,Observaciones,Problema_Salud1,Hospitalizado,Bajo_Tratamiento,Inyectandose,Problema_Salud1_si,Problema_Salud1_no,Hospitalizado_si,Hospitalizado_no,Bajo_Tratamiento_si,Bajo_Tratamiento_no,Inyectandose_si,Inyectandose_no,Problemas_anestecia_si,Problemas_anestecia_no,Alergico_si,Alergico_no,Sangramiento_si,Sangramiento_no,Medicamentos,Medicamentos_si,Medicamentos_no,Embarazada,Embarazada_si,Embarazada_no,Pulso,FreR,PA_Sangre,Enfermedad_Corazon,Lesiones_Conjenitas_Corazon,Soplo_Cardiaco,Presion_Alta,Presion_Baja,Bronquiales,Asma,Rinitis,Tos,Icteria,Hepatitis,Tifodea,Accidentes_Cerebrales,Amigdalitis,Fiebre_Reumatica,Amigdalas_Removidas,Adenides_Removidas,Escarlatina,Paperas,Epilepsia,Otitis,Artritis _
tuberculosis,Sinusitis,Diabetes,Paralisis_Cerebral,Otra,Otra_especifique " & vbCrLf & _
"FROM Pacientes ORDER BY ID } AS ParentCMD APPEND " & vbCrLf & _
"({SELECT ID,Apellido,Nombre,Fecha_Nacimiento,Estatura,Peso,Direccion,Telefono,Profecion,Nombre_Empresa,Direccion_Empresa,Medico_Anterior,Referido_por,Motivo_Consulta,Tel_Emergencia1,Nombre_Emergencia1,Nombre_Emergencia2,Tel_Emergencia2,Tipo_Sangre,Ultimo_Tratamiento,Historia_Clinica,Foto,Otros_Datos,Observaciones,Problema_Salud1,Problema_Salud1_si,Problema_Salud1_no,Hospitalizado,Hospitalizado_si,Hospitalizado_no,Bajo_Tratamiento,Bajo_Tratamiento_si,Bajo_Tratamiento_no,Inyectandose,Inyectandose_si,Inyectandose_no,Problemas_anestecia_si,Problemas_anestecia_no,Alergico_si,Alergico_no,Sangramiento_si,Sangramiento_no,Medicamentos,Medicamentos_si,Medicamentos_no,Embarazada,Embarazada_si,Embarazada_no,Pulso,FreR,PA_Sangre,Enfermedad_Corazon,Lesiones_Conjenitas_Corazon,Soplo_Cardiaco,Presion_Alta,Presion_Baja,Bronquiales,Asma,Rinitis,Tos,Icteria,Hepatitis,Tifodea,Accidentes_Cerebrales,Amigdalitis,Fiebre_Reumatica,Amigdalas_Removidas,Adenides_Removidas,Escarlatina,Paperas,Epilepsia,Otitis,Artritis,Tuberculosis, _
"FROM Pacientes } AS ChildCMD RELATE ID TO ID) AS ChildCMD"
Syntax Error
Hi
I wonder if someone can help me, I have the following code which writes a value to an .ini file but I cannot get it to compile. Can anybody see the syntax error in the code.
****************module code***************************
Public Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Public Sub WriteINI(sINIFile As String, sSection As String, sKey As String, sValue As String)
Dim iCounter As Integer
Dim sTemp As String
sTemp = sValue
For iCounter = 1 To Len(sValue)
If Mid$(sValue, iCounter, 1) = vbCr Or Mid$(sValue, iCounter, 1) = vbLf Then Mid$(sValue, iCounter) = " "
Next iCounter
iCounter = WritePrivateProfileString(sSection, sKey, sTemp, sINIFile)
End Sub
******************Main code****************************
The syntax error is in this line:
WriteINI("C:My DocumentsdbData.ini", "Data", "Taxrate", "0")
************************************************
Thanks for any help
Scouse
Syntax Error
I have a form in an Access database, only one form, that needs to create certificates in Word, after dropping the necessary information (name, address, ID#, etc.) in Excel. I seemed to have the hang of it, then got an error that I don't have a clue of how to fix. The error is:
"Syntax error in date in query expression '#' WHERE (((Fiem_WholesaleFood.Firm_ID)=get WholesaleFoodId(0) Or (Firm....
And it goes on from there. It is rather involved and I do not believe I can describe my problem without sending the form and code to whomever is kind enough to help me. The process was actually working, then I made a few changes and the whole thing has blown up in my face. I'm in need of emergency help, because I need to get this done TONIGHT! I'm appealing to all experts who could help - PLEASE!
Sincerely,
Zoegirl
Syntax Error
Hey guys! I'm having some trouble with my syntax for these joins...
Code:
RSRel.Open "SELECT DISTINCTROW candy.candy_Number, tree.L_Name, Trans_type.Rate, [tree].[L_Name] & ', ' & [tree].[F_Name] AS Expr1 FROM Trans_type INNER JOIN (Court_Type INNER JOIN ((family INNER JOIN (tree INNER JOIN (candy INNER JOIN candy_Assignment ON candy.candy_Number = candy_Assignment.candy) ON tree.ID = candy_Assignment.Attny_ID) ON family.ID = candy.family_ID) INNER JOIN (Fiscal_Group INNER JOIN Transaction ON Fiscal_Group.ID = Transaction.Group) ON candy_Assignment.ID = Fiscal_Group.Assign_ID) ON Court_Type.Code = candy.Court) ON Trans_type.ID = Transaction.Trans_Type WHERE ((([tree].[L_Name] & ', ' & [tree].[F_Name])='" & cmbtree & "'))", Conn
It is telling me there is a syntax error in the from clause. But I don't see it?
Syntax Error
Hi everyone! First I have to say how helpful this forum has been and how much I have learned in the Tutor's corner and just searching the different forums. I have just finished my very first VB application and I couldn't have done it without all of you!
But now I'm beginning to realize that a program is never really finished. There are always bugs to work out and countless enhancements to be made. One of the many "bugs" occurs on only one out of the 2 computers the application has been installed on. I'm using ADODC with an MSAccess database. One of the users gets a Syntax Error with the following line:
Code:
adoHistory.RecordSource = "select BeginTime,RemoteNumber,Duration,Country,TotCost,TotRate from CDRHistory where BeginTime >= #" & dtmBegDate & "# AND BeginTime <= #" & dtmEndDate & "# order by BeginTime"
It's been very tough to figure this out since I can not duplicate the error on my machine. Can anyone see anything in the SQL Query that could cause a potential problem?
Thanks for any input!
SQL Syntax Error
Can anyone help me figure out the correct syntax for my Select statement. I feel like I've tried everything under the sun to no avail. My Select statement is this:
Code:
adoActivity.RecordSource = "select * from CDR where E164 = " & strID(Index)
What should the proper syntax be, since this one is obviously not right?
Thanks for any input.
Syntax Error
Hi,
i met an error while running this line.
Set pDL = db.OpenRecordset("SELECT [printinglist].* " & _
"FROM [printinglist] " & _
"WHERE [printinglist].DocumentNo = " & pID & " AND [Printing].name = " & CUI & ";")
The error msg is "error 3061, Too few parameters. Expected 1."
The database, db has all the the columns that are needed.
i tried changin the code to the following but to no avail.
Set pDL = db.OpenRecordset("SELECT [printinglist].* " & _
"FROM [printinglist] " & _
"WHERE [printinglist].DocumentNo = '" & pID & "' AND [Printing].name = '" & CUI & "';")
Can someone please help me? Thanks a lot.
Regards,
Syntax Error
Could anyone tell me why this is getting a syntax error please in the insert into
strSQL = "INSERT INTO tblImport(eventid,day,time,finish,class,lecturer,mod,type,room,weeks) Values ('" & streventid & "' , '" _
& strday & "' , '" _
& strTime & "' , '" _
& strFinish & "' , '" _
& strClass & "' , '" _
& strReversedNames2 & "' , '" _
& strMod & "' , '" _
& strType & "' , '" _
& strRoom & "' , '" _
& strWeeks & "' ) "
Set rsImport = adoconnection.Execute(strSQL)
thanks
SQL - Syntax Error
Hi.
i'm having some problems with this. I have used SQL quite abit but i can't for the life of me see what it wrong with this.
I have neva used SQL in VB before, but i thought SQL was SQL.
anyway its bound to be something simple, just need a fresh set of eyes.
Code:
sql = "INSERT INTO players (Date, Forename, Surname, Addy1, Addy2, City, Postcode, Tel, Email) VALUES ('" & theDate & "', '" & txtForename.Text & "', '" & txtSurname.Text & "', '" & txtAddy1.Text & "', '" & txtAddy2.Text & "', '" & txtCity.Text & "', '" & txtPostcode.Text & "', '" & txtTel.Text & "', '" & txtEmail.Text & "');"
Thanks
Chris Colden
SQL Syntax Error
Hi
I am trying to sort my data using recordset.
I am currently using the following line to define my recordset:
rs.Open "SELECT [ID],[Symbol],[OrderType],[Order],[Time Placed] FROM [FilledOrders]", Con, 1, 2, adCmdText
I am wanting to define the data in deccending order using field 1 which is [ ID ].
I think the line should look something like this, but I cannot get the synatx right:
Set rs = Db.OpenRecordset("SELECT [ID],[Symbol],[OrderType],[Order],[Time Placed] FROM [FilledOrders]" ORDER BY [Field1] DESC")
If anyone can help me I would be most greatful
Lisa
Syntax Error... But I Can't See It.. Again..
Code:
Public FoxC As ADODB.Connection
Public FoxR As ADODB.Recordset
Public Function OpenFox()
Set FoxC = New ADODB.Connection
Set FoxR = New ADODB.Recordset
FoxC.Open ("Driver=Microsoft Visual Foxpro Driver; UID=;SourceType=DBF;SourceDB=" & App.Path)
End Function
Public Function CloseFox()
FoxC.Close
Set FoxC = Nothing
Set FoxR = Nothing
End Function
OpenFox
FoxR.Open ("INSERT INTO DATABASE(PAID,MEMBER,PARTYNUM,PLAYERNUM,TTIME,FNAME,LNAME,DAY,MONTH,NINE) VALUES(" & paid1 & "," & member1 & "," & partynum1 & "," & playnum & "," & time1 & "," & fname1 & "," & lname1 & "," & day1 & "," & month1 & "," & gridclick & ")"), FoxC
CloseFox
SQL Syntax Error
Hi Guys i have a little problem with a query expresion an I need your help. I do nothandle verywell the sql parameter and I got this error :
Run time Error "3075"
Syntax error(missing operator) in query expression 'PoMaster.Trans' =.
I want to compare the content of a textbox "txtOrders" to a numeric field called "Trans", I am using MSaccess 2003 here is my code:
Set rsOrders = db.OpenRecordset("SELECT PoDetail.RecordID," _
& "PoDetail.ItemID, PoDetail.ItemName, PoDetail.Quantity," _
& "PoDetail.Unit, PoDetail.UnitPrice, PoDetail.CostPrice," _
& "PoDetail.Category, PoMaster.RecordID, PoMaster.Trans," _
& "PoMaster.Vendor, PoMaster.Account, PoMaster.UserID " _
& "FROM PoDetail INNER JOIN PoMaster ON " _
& "PoDetail.RecordID = PoMaster.RecordID " _
& "WHERE PoMaster.Trans =" & txtOrders & "")
Thanks for your help all of you guys!
Syntax Error
I am getting the following error in the following piece of code"
runtime error "3077"
"syntax error (missing operator) in expression"
this line is highlighted .FindFirst "Word = '" & gFindString & "' "
If (Len(gFindString) > 0) Then
With datDict.Recordset
.FindFirst "Word = '" & gFindString & "' "
If (.NoMatch) Then
iReturn = MsgBox("Word " & gFindString & _
" was not found.", vbCritical, "Record not found")
End If
End With
End If
what's happening here is I have a listbox with about 3000 words. Everything seems to work until I get to the two words listed below. When I click on the first on it displays the english meaning in a label control which is fine, however, when i moved to the second word I still get the meaning for the first word which is wrong. Then when I try to return to the calling form I get the above error. Also when I click on any word everything is fine but when I click on the second word below I do not get the english meaning even though it is on the access database.
Any suggestion would be helpfull.
À l’egard de
A l'encre
SQL Syntax Error - HELP!!!!
Morning all,
I have a database with with about 300 records in it, Whick will grow somewhat as time goes by. Anyhow,
I am trying to get just the info for the specific job requested (generatorid) which will return all the records for that job only into a list.
Code:
Private Sub GetGenStatus (Byval JN As String)
Dim oConn As ADODB.Connection
Dim rRex As ADODB.Recordset
Dim SQL As String
Dim tTotal As Double
'Init the objects
Set oConn = New ADODB.Connection
Set rRex = New ADODB.Recordset
oConn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & App.Path & "custdb.mdb"
SQL = "SELECT generatorid, genlname, SUM(ytdtotal) AS TotalCost, GenLoads FROM generators WHERE generatorid = JN"
'Fill recordset
Call rRex.Open(SQL, oConn, adOpenKeyset, adLockOptimistic, adCmdText)
Do Until rRex.EOF
[b]NOTE: lstLoadList is a 5 column listbox[/b]
lstLoadList.AddItem Date & ";" & rRex.Fields("generatorid").Value & ";" & rRex.Fields("genlname").Value & ";" & rRex.Fields("generatorid").Value & ";" & rRex.Fields("generatorid").Value & ";" & rRex.Fields("TotalCost").Value
rRex.MoveNext
Loop
'Shut everything down
rRex.Close
oConn.Close
'Impotant to clean up, too
Set rRex = Nothing
Set oConn = Nothing
End Sub
Here is my code that now works BUT puts ALL the jobs in, not just the one selected.
Code:
Private Sub GetGenStatus(ByVal JN As String)
''''Will get all dates and totals for the currently selected job
Dim oConn As ADODB.Connection
Dim rRex As ADODB.Recordset
Dim SQL As String
Dim tTotal As Double
'Init the objects
Set oConn = New ADODB.Connection
Set rRex = New ADODB.Recordset
oConn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & App.Path & "custdb.mdb"
SQL = "SELECT GenJobNum, genlname, SUM(ytdtotal) AS TotalCost, GenLoads FROM generators GROUP BY GenJobNum, GenLName, GenLoads" ' WHERE GenJobNum = " & JN
'Fill recordset
Call rRex.Open(SQL, oConn, adOpenKeyset, adLockOptimistic, adCmdText)
Do Until rRex.EOF
lstLoadList.AddItem Date & ";" & rRex.Fields("GenJobNum").Value & ";" & rRex.Fields("genlname").Value & ";" & rRex.Fields("GenJobNum").Value & ";" & rRex.Fields("GenJobNum").Value & ";" & rRex.Fields("TotalCost").Value
rRex.MoveNext
Loop
'Shut everything down
rRex.Close
oConn.Close
'Impotant to clean up, too
Set rRex = Nothing
Set oConn = Nothing
End Sub
Syntax Error
I am trying to connect to a database and I am getting a syntax error in the from clause.
Does anyone know what this means and how to fix it? I connected to databases a week ago and everything worked fine.
Assistance would be appreciated.
SQL Syntax Error
Can anyone tell me why im getting an syntax error on the following sql command please?
UPDATE finalTable SET finalTable.IP = 158Range.GH04531 WHERE InventoryNo.[Asset No#] = 158Range.[GHNUM]
im trying to add a list of ip address into the finalTable.IP column from table 158range where InventoryNo.[Asset No#] and 158Range.[GHNUM] match
thx in advance
Peter
Syntax Error
I'm getting a "Syntax error(missing operator) in query expression 'UName 'whatever". The error is on the UpDate line. Can someone tell me why I'm getting this error?
Code:
Dim c As Integer
Dim oConn As ADODB.Connection
Dim MyRecSet As ADODB.Recordset
Set oConn = New ADODB.Connection
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & App.Path & "Employeedb.mdb;"
Set MyRecSet = oConn.Execute("SELECT EName, UName, Password FROM EData")
MyRecSet.MoveFirst
Do While Not MyRecSet.EOF
For c = 0 To MyRecSet.Fields.Count - 1
If MyRecSet.Fields("EName") = MyVar And MyRecSet.Fields("UName") <> CPUNtxt.Text Then
MsgBox "You miss typed your User Name!"
Exit Sub
ElseIf MyRecSet.Fields("UName") = CPUNtxt.Text And MyRecSet.Fields("Password") = CPPtxt.Text Then
oConn.Execute "Update EData Set [Password] = '" & TNPtxt.Text & "' Where UName '" & CPUNtxt.Text & "'"
Exit Do
ElseIf TNPtxt.Text <> CPtxt.Text Then
MsgBox "Sorry, your new password and confirm password does not match!"
Exit Sub
ElseIf MyRecSet.Fields("UName") = CPUNtxt.Text And MyRecSet.Fields("Password") <> CPPtxt.Text Then
MsgBox "Sorry, wrong password!"
Exit Sub
End If
Next c
MyRecSet.MoveNext
Loop
oConn.Close
Help Syntax Error Using ADO..
hello everyone,
I've read about tutorial in your forum in ADO and a great help of it..
Am new to vb, kindly see my code...
Private Sub Command1_Click()
Dim Myconn As ADODB.Connection
Dim Myrecset As ADODB.Recordset
Set Myconn = New ADODB.Connection
Myconn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; _
DataSource=C:Mydb.mdb;"
Myconn.Open
Set Myrecset = Myconn.Execute("SELECT CustomerName, _
CustomerAddress, PhoneAddress FROM Customer")
Myconn.Close
End Sub
___________________________________
The Error is...
Runtime Error -2147467259 (80004005)
Could not find installable ISAM
____________________________________
I know what it's mean..but how can fix this...-2147467259 "Data source name not found and no default driver specified", but i check it my datsource is fine..
OS = Winxpsp2
VB6 = Enterprise Edition
Acess = OFFICE XP 2003
Thanks for the help,
Sql Syntax Error
Hi can you tell me whats wrong with this syntax, when i want to get data from combo box
Code:
sql = "SELECT * FROM tbljob_Details WHERE (Client_ID='" & cboCl.Text & "')"
rsJobs.Open sql, con, adOpenDynamic, adLockBatchOptimistic, adCmdTable
i get runtime error -2147217900(80040e14)
syntax error in from clause
SQL Syntax Error
I have checked the spelling a dozen times and I can not figure out why this will not work
Code:
SELECT SUM(Transaction) FROM Money WHERE Division = 1
I keep getting this error
Syntax error in FROM clause
BTW: This is a MS Access Database
SQL: Why A Syntax Error?
Code:
db.Execute "INSERT INTO [addl-costs]" & _
" (quote_num,sequence,desc,qty1,qty2,qty3,qty4,qty5,qty6,qty7,qty8,osq_num,post_m)" & _
" VALUES (" & tempAC.quote_num & "," & tempAC.sequence & ",'" & Trim(tempAC.description) & "'," & tempAC.cost(1) & "," & tempAC.cost(2) & "," & tempAC.cost(3) & "," & tempAC.cost(4) & "," & tempAC.cost(5) & "," & tempAC.cost(6) & "," & tempAC.cost(7) & "," & tempAC.cost(8) & ",'" & Trim(tempAC.osq_num) & "'," & tempAC.post_m & ")"
'class
Private m_quote_num As Long
Private m_sequence As Integer
Private m_description As String * 50
Private Const MAX_INDEX = 8
Private m_cost(1 To MAX_INDEX) As Double
Private m_osq_num As String * 14
Private m_post_m As Integer
Syntax Error
This code is giving me a syntax error. It takes values from txtSearch1, txtSearch3 and txtSearch2 and generates the results.
Suppose there are three records.
1] This is A
2] This is B
3] This is C
txtsearch1 = A
txtsearch3 = B
txtsearch2 = c
It should bring up the first two records, but not the last one.. but it gives me a run-time error 3075 saying missing expression.. but i cant figure out which one
Code:
Function DynamicSQL() As String
Dim s() As String
Dim i As Integer
Dim strDynamicSQL As String
'--------------------------------------
If Trim$(txtSearch1.Text) <> "" Then
s = Split(txtSearch1.Text, " ")
For i = 0 To UBound(s)
strDynamicSQL = strDynamicSQL & "'*" & s(i) & "*'"
If i < UBound(s) Then
strDynamicSQL = strDynamicSQL & " OR Field1 LIKE "
End If
Next
DynamicSQL = "SELECT * FROM [Main] WHERE (Field1 LIKE " & strDynamicSQL & ")"
strDynamicSQL = DynamicSQL
End If
'-------------------------------------
If Trim$(txtSearch2.Text) <> "" Then
s = Split(txtSearch2.Text, " ")
If Trim$(txtSearch1.Text) <> "" Then
strDynamicSQL = strDynamicSQL & " AND (Field1 NOT LIKE "
End If
For i = 0 To UBound(s)
strDynamicSQL = strDynamicSQL & "'*" & s(i) & "*'"
If i < UBound(s) Then
strDynamicSQL = strDynamicSQL & " OR Field1 NOT LIKE "
End If
Next
If Trim$(txtSearch1.Text) <> "" Then
DynamicSQL = strDynamicSQL & ")"
Else
DynamicSQL = "SELECT * FROM [Main] WHERE (Field1 NOT LIKE " & strDynamicSQL & ")"
End If
End If
'------------------------------------
If Trim$(txtSearch3.Text) <> "" Then
s = Split(txtSearch3.Text, " ")
If Trim$(txtSearch1.Text) <> "" Then
strDynamicSQL = strDynamicSQL & " AND (Field1 LIKE "
End If
For i = 0 To UBound(s)
strDynamicSQL = strDynamicSQL & "'*" & s(i) & "*'"
If i < UBound(s) Then
strDynamicSQL = strDynamicSQL & " OR Field1 LIKE "
End If
Next
If Trim$(txtSearch1.Text) <> "" Then
DynamicSQL = strDynamicSQL & ")"
Else
DynamicSQL = "SELECT * FROM [Main] WHERE (Field1 LIKE " & strDynamicSQL & ")"
End If
End If
End Function
|