Syntax Error 3075

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • GLEberts
    New Member
    • Mar 2008
    • 51

    Syntax Error 3075

    I can not seem to get rid of this syntax error - hope someone can help out.
    the error I am getting is:

    Run time Error 3075
    Syntax error missing operator in query expression
    [AcctHolderID]=name

    I have two forms (1) one with a combo box "cbobankacc t" on form "accttransactio nlist"

    I am successful to have the value from the combo box generate into a text box of a second form.

    second form "accttranslistp assword" and the text box that I am trying to generate the value into is "txtaccthol der.

    the value seems to imput in the text box fine but I get the syntax error when I try to run the password script.

    Code:
    Private Sub cbobankacct_AfterUpdate()
       DoCmd.OpenForm "AcctTransListPassword"
       Forms!AcctTransListPassword!txtacctholder = Forms!AcctTransactionList!cbobankacct.Column(1)
        
    End Sub
    I then have a text box "txtpasswor d" that I input the password into and that is when I get the syntax error

    Code:
    Private Sub txtpassword_AfterUpdate()
      
        If IsNull(Me.txtpassword) Or Me.txtpassword = "" Then
          MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
            Me.txtpassword.SetFocus
            Exit Sub
        End If
    
        If Me.txtpassword.value = DLookup("Password", "AcctHolder", _
                "[AcctHolderID]=" & Me.txtacctholder.value) Then
    
            MyAcctHolderID = Me.txtacctholder.value
    
            DoCmd.Close acForm, "AcctTransListPassword", acSaveNo
            DoCmd.RunMacro "AcctHolderMDB"
    
        Else
          MsgBox "Password Invalid. Please Try Again", vbOKOnly, _
                "Invalid Entry!"
            Me.txtpassword.SetFocus
        End If
    
        
    End Sub
    If anyone can give me some direction that would be great! Everyone on this site has always been very helpful in the past.
    Thanks
    Gary
    Last edited by Stewart Ross; Feb 28 '10, 09:25 AM. Reason: Please use the [code] tags provided to bracket your code segments, like this [/code]
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    If "[AcctHolderID] is a String, then you would need a change in Syntax to:
    Code:
    If Me.txtpassword.Value = DLookup("Password", "AcctHolder", _
                "[AcctHolderID]= '" & Me![txtacctholder] & "'") Then

    Comment

    • GLEberts
      New Member
      • Mar 2008
      • 51

      #3
      thanks for the help! that did the trick!!!
      thanks again.
      gary

      Comment

      Working...