Current location: Hot Scripts Forums » Programming Languages » Visual Basic » Syntax error. operation error


Syntax error. operation error

Reply
  #1 (permalink)  
Old 07-13-10, 03:40 PM
jayhighway jayhighway is offline
New Member
 
Join Date: Jul 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Syntax error. operation error

Recently out whole database crashed and i have recieved many syntax errors stating sytanx error ( operator error) in query expression "section = "

that is the error im getting for local vouchers which is the top entry in the below coding.


Option Compare Database
Code:
Private Sub LocalVouchers_Click()
On Error GoTo Err_LocalVouchers_Click

    Dim stDocName As String
    Dim STLink As String
    

    stDocName = "rptLocalVoucherSuppervisor"
    STLink = "Section = " & Me!Combo2
    DoCmd.OpenReport stDocName, acPreview, , STLink

Exit_LocalVouchers_Click:
    Exit Sub

Err_LocalVouchers_Click:
    MsgBox Err.Description
    Resume Exit_LocalVouchers_Click
    
End Sub
Private Sub TravelAuths_Click()
On Error GoTo Err_TravelAuths_Click

    Dim stDocName As String
    Dim STLink As String
    
    STLink = "Section = " & Combo2
    

    stDocName = "rptSupervisorTravelAuths"
    DoCmd.OpenReport stDocName, acPreview, , STLink

Exit_TravelAuths_Click:
    Exit Sub

Err_TravelAuths_Click:
    MsgBox Err.Description
    Resume Exit_TravelAuths_Click
    
End Sub
Private Sub TravelVouchers_Click()
On Error GoTo Err_TravelVouchers_Click

    Dim stDocName As String
    Dim STLink As String
    

    stDocName = "rptSupervisorTravelVchs"
    STLink = "Section = " & Combo2
    DoCmd.OpenReport stDocName, acPreview, , STLink

Exit_TravelVouchers_Click:
    Exit Sub

Err_TravelVouchers_Click:
    MsgBox Err.Description
    Resume Exit_TravelVouchers_Click
    
End Sub
Private Sub TravelIOP_Click()
On Error GoTo Err_TravelIOP_Click

    Dim stDocName As String
    Dim STLink As String
    

    stDocName = "rptTravelVchTotalIOP"
    STLink = "Section = " & Combo2
    DoCmd.OpenReport stDocName, acPreview, , STLink

Exit_TravelIOP_Click:
    Exit Sub

Err_TravelIOP_Click:
    MsgBox Err.Description
    Resume Exit_TravelIOP_Click
    
End Sub
Private Sub Command8_Click()
On Error GoTo Err_Command8_Click


    DoCmd.Close

Exit_Command8_Click:
    Exit Sub

Err_Command8_Click:
    MsgBox Err.Description
    Resume Exit_Command8_Click
    
End Sub
Private Sub LocalVouchersReport_Click()
On Error GoTo Err_LocalVouchersReport_Click

    Dim stDocName As String
    Dim STLink As String

    STLink = "Section = " & Me!Combo2
    stDocName = "rptLocalVouchers"
    DoCmd.OpenReport stDocName, acPreview, , STLink

Exit_LocalVouchersReport_Click:
    Exit Sub

Err_LocalVouchersReport_Click:
    MsgBox Err.Description
    Resume Exit_LocalVouchersReport_Click
    
End Sub
Private Sub Procurement_Click()
On Error GoTo Err_Procurement_Click

    Dim stDocName As String
    Dim stLinking1 As String
    
'stLinking1 = "SectionName = " & Me!Combo2

    stDocName = "rptUnitRequestStatus"
    DoCmd.OpenReport stDocName, acPreview

Exit_Procurement_Click:
    Exit Sub

Err_Procurement_Click:
    MsgBox Err.Description
    Resume Exit_Procurement_Click
    
End Sub
Private Sub OtherTransactions_Click()
On Error GoTo Err_OtherTransactions_Click

    Dim stDocName As String
    Dim stLinking As String
    
    stLinking = "Section = " & Me!Combo2

    stDocName = "rptOtherTransactionsSection"
    DoCmd.OpenReport stDocName, acPreview, , stLinking

Exit_OtherTransactions_Click:
    Exit Sub

Err_OtherTransactions_Click:
    MsgBox Err.Description
    Resume Exit_OtherTransactions_Click
    
End Sub
Private Sub TravelChart_Click()
On Error GoTo Err_TravelChart_Click

    Dim stDocName As String

    stDocName = "mgtchrtTravelGOEPurposes"
    DoCmd.OpenReport stDocName, acPreview

Exit_TravelChart_Click:
    Exit Sub

Err_TravelChart_Click:
    MsgBox Err.Description
    Resume Exit_TravelChart_Click
    
End Sub
Private Sub PurchaseChart_Click()
On Error GoTo Err_PurchaseChart_Click

    Dim stDocName As String
    
    
    stDocName = "mgtchrtClassificaitonBreakdownProcurement"
    DoCmd.OpenReport stDocName, acPreview

Exit_PurchaseChart_Click:
    Exit Sub

Err_PurchaseChart_Click:
    MsgBox Err.Description
    Resume Exit_PurchaseChart_Click
    
End Sub
Private Sub SupplyBreakdown_Click()
On Error GoTo Err_SupplyBreakdown_Click

    Dim stDocName As String

    stDocName = "mgtrptProcurementClassTypes"
    DoCmd.OpenReport stDocName, acPreview

Exit_SupplyBreakdown_Click:
    Exit Sub

Err_SupplyBreakdown_Click:
    MsgBox Err.Description
    Resume Exit_SupplyBreakdown_Click
    
End Sub
Private Sub GeneralIOP_Click()
On Error GoTo Err_GeneralIOP_Click

    Dim stDocName As String
    Dim STLink As String
    
  '  stlink =

    stDocName = "mgtrptTravelByGOEandIOP"
    DoCmd.OpenReport stDocName, acPreview

Exit_GeneralIOP_Click:
    Exit Sub

Err_GeneralIOP_Click:
    MsgBox Err.Description
    Resume Exit_GeneralIOP_Click
    
End Sub
Private Sub Command17_Click()
On Error GoTo Err_Command17_Click

    Dim stDocName As String

    stDocName = "UpdateDon'sTravelReport1st"
    DoCmd.RunMacro stDocName

Exit_Command17_Click:
    Exit Sub

Err_Command17_Click:
    MsgBox Err.Description
    Resume Exit_Command17_Click
    
End Sub
Private Sub Command18_Click()
On Error GoTo Err_Command18_Click

    Dim stDocName As String

    stDocName = "UpdateDon'sTravelReport2nd"
    DoCmd.RunMacro stDocName

Exit_Command18_Click:
    Exit Sub

Err_Command18_Click:
    MsgBox Err.Description
    Resume Exit_Command18_Click
    
End Sub
Private Sub Command19_Click()
On Error GoTo Err_Command19_Click

    Dim stDocName As String

    stDocName = "UpdateDon'sTravelReport3rd"
    DoCmd.RunMacro stDocName

Exit_Command19_Click:
    Exit Sub

Err_Command19_Click:
    MsgBox Err.Description
    Resume Exit_Command19_Click
    
End Sub
Private Sub Command20_Click()
On Error GoTo Err_Command20_Click

    Dim stDocName As String

    stDocName = "UpdateDon'sTravelReport4th"
    DoCmd.RunMacro stDocName

Exit_Command20_Click:
    Exit Sub

Err_Command20_Click:
    MsgBox Err.Description
    Resume Exit_Command20_Click
    
End Sub
Private Sub Command25_Click()
On Error GoTo Err_Command25_Click

    Dim stDocName As String

    stDocName = "rptARRAStimulusCost"
    DoCmd.OpenReport stDocName, acPreview

Exit_Command25_Click:
    Exit Sub

Err_Command25_Click:
    MsgBox Err.Description
    Resume Exit_Command25_Click
    
End Sub

Last edited by Nico; 08-05-10 at 12:21 PM.
Reply With Quote
  #2 (permalink)  
Old 08-05-10, 09:08 AM
Yeronimo Yeronimo is offline
Newbie Coder
 
Join Date: Aug 2010
Location: Nijmegen, Netherlands
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
What happens if you try: Me!Combo2.Value

So with .Value after it?

And what does your watch window say if you add:

?"Section = " & Me!Combo2


What does is evaluate to?

Last edited by Yeronimo; 08-05-10 at 09:32 AM.
Reply With Quote
  #3 (permalink)  
Old 10-01-11, 06:04 AM
jon001 jon001 is offline
Newbie Coder
 
Join Date: Sep 2011
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
open the module and check the references. There must be a reference missing to the runtime
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sites Down Because Of Same Parse error: syntax error, Tony S. PHP 8 07-24-09 05:55 PM
C++ and MSSQL tutorials? scott2500uk C/C++ 8 05-11-09 02:33 AM
Syntax Error Nikas Database 4 05-15-08 10:48 AM
I cannot find what i messed up. Parse error: syntax error, unexpected T_CONSTANT_ENCA bilicek.com PHP 3 01-31-08 04:54 PM
MySQL Syntax error gigafare PHP 4 04-19-06 02:03 AM


All times are GMT -5. The time now is 01:18 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.