Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating foxpro database with VB 6.0

Status
Not open for further replies.

07sprint

Programmer
Sep 18, 2003
25
0
0
US
The ERROR MESSAGE is between the ************
************

Set cn = CreateObject("ADODB.Connection")
cn.ConnectionString = "Provider=vfpoledb.1;Data Source =D:\PerCap1\percap2.dbf"
cn.Open

'Formatting Date

strSTR = strADDDATE
strYear = Right(strSTR, 4)
strMonth = Left(strSTR, 2)
strDay = Mid(strSTR, 4, 2)
strDate = (strMonth & strDay & strYear)
strDate1 = strYear & "/" & strMonth1 & "/" & strDay

'Declare and set the Command

Dim cmd As ADODB.Command
Set cmd = New ADODB.Command
cmd.ActiveConnection = cn
'cmd.CommandText = strSQL

'Declare and Set the RecordSet

Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset

'UpDating Record

strSQL = "Update percap2 Set "
strSQL = strSQL & "Dist = "
strSQL = strSQL & "'" & gstrDIST & "'"
strSQL = strSQL & ", "
strSQL = strSQL & "GEN = "
strSQL = strSQL & "'" & strGEN & "'"
strSQL = strSQL & ", "
strSQL = strSQL & "SUB = "
strSQL = strSQL & "'" & strSUB & "'"
strSQL = strSQL & ", "
strSQL = strSQL & "ADDR1 = "
strSQL = strSQL & "'" & strADDR1 & "'"
strSQL = strSQL & ", "
strSQL = strSQL & "ADDR2 = "
strSQL = strSQL & "'" & strADDR2 & "'"
strSQL = strSQL & ", "
strSQL = strSQL & "ADDR3 = "
strSQL = strSQL & "'" & strADDR3 & "'"
strSQL = strSQL & ", "
strSQL = strSQL & "ZIP = "
strSQL = strSQL & "'" & strZIP & "'"
strSQL = strSQL & ", "
strSQL = strSQL & "ZIP4 = "
strSQL = strSQL & "'" & strZIP4 & "'"
strSQL = strSQL & ", "
strSQL = strSQL & "OCCUPCODE = "
strSQL = strSQL & "'" & strOCC & "'"
strSQL = strSQL & ", "
strSQL = strSQL & "OCCVALUE = "
strSQL = strSQL & "'" & strOCCVAL & "'"
strSQL = strSQL & ", "
strSQL = strSQL & "ADDDATE = "
strSQL = strSQL & "'" & strDate1 & "'"
strSQL = strSQL & ", "
strSQL = strSQL & "SYSDATE = "
strSQL = strSQL & "'" & strSYSDATE & "'"
strSQL = strSQL & ", "
strSQL = strSQL & "SYSTYPE = "
strSQL = strSQL & "'" & strSYSTYPE & "'"
strSQL = strSQL & " Where Name = "
strSQL = strSQL & "'" & strName & "'"

'Declare and set the Command

cmd.CommandText = strSQL

************************************
cmd.Execute intRecordAffected

ERROR MESSAGE: syntax error

I don't think it like inRecordAffected

************************************
Set cmd = Nothing

'Checking to see if record failed to UpDate

If (intRecordAffected = 0) Then
MsgBox "Update Failed", _
vbInformation, "Error"
End If
 
I'm check to see if the record is update or not. when I step through it, I get to the code

cmd.Execute intRecordAffect
then I get the error message. what else do you want to knew.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top