Quantcast
Channel: Tech Support Guy
Viewing all articles
Browse latest Browse all 29110

Run time error 3705 - Syntex error (Missing operator) in query expression Access

$
0
0
Hello,
I am trying to edit the data to open on a form based on selection on the combo box, here is the code below;


Code:

Private Sub CmdEditExistingRecord_Click()          DoCmd.OpenForm "Master_data", acNormal, "", BuildFilter, acFormEdit, acWindowNormal      End Sub  Private Function BuildFilter() As Variant    Dim varWhere As Variant    Dim varstrat As Variant    Dim varItem As Variant    Dim intIndex As Integer      varWhere = Null  ' Main filter    varstrat = Null  ' Subfilter used for colors                        ' Check for Tendor_no    If Me.CmbTendor > "" Then        varWhere = varWhere & "[Tender_Number] Like """ & Me.CmbTendor & """ And "    End If          ' Check for buyer  If Me.Cmbbuyer > "" Then        varWhere = varWhere & "[BuyerID] Like """ & Me.Cmbbuyer & """ AND "    End If        ' Check for CategoryID    If Me.Cmbcategory > "" Then        varWhere = varWhere & "[CategoryID] Like """ & Me.Cmbcategory & """ AND "    End If                    ' Test to see if we have subfilter for colors...    If IsNull(varstrat) Then        ' do nothing    Else        ' strip off last "OR" in the filter        If Right(varstrat, 4) = " OR " Then            varstrat = Left(varstrat, Len(varstrat)          End If                  ' Add some parentheses around the subfilter        varWhere = varWhere & "( " & varstrat & " )"    End If              ' Check if there is a filter to return...    If IsNull(varWhere) Then        varWhere = ""    Else        varWhere = "WHERE" & varWhere                  ' strip off last "AND" in the filter        If Right(varWhere, 5) = " AND " Then            varWhere = Left(varWhere, Len(varWhere)          End If    End If          BuildFilter = varWhere      End Function

I am getting a error in this codes as "Run time error 3705 - Syntex error (Missing operator) in query expression". can you please tell me what i am doing wrong in this codes.
Another question i want to make this combo box inter related to each other like one tendor _No selected its related data's only have to show it in other combo's. This applies to all other combo's as well.

Viewing all articles
Browse latest Browse all 29110

Trending Articles