Solved Dlookup result of Manager Codes combobox returning Manager Name from table (1 Viewer)

LeeHutchins

New member
Local time
Today, 02:38
Joined
Nov 3, 2020
Messages
13
Having the following message appear after using the below code,

Run-Time error '3075':
Syntax error (missing operator) in query expression 'ManagerCode - 813 L'.

could the issue be because of the characters spaces and numbers?

this is a long standing manager code format within the business that i cant change and i fear changing this for the purposed of my form will confuse some.



Code:
Private Sub AccountManagerInput_AfterUpdate()
Dim ManagerName As String
  
   ManagerName = DLookup("ManagerName", "AccountManagerTable", "ManagerCode = " & Me.AccountManagerInput)
  
   Me.AccountManagerName = ManagerName
  
End Sub

thanks in advance
 

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 21:38
Joined
May 21, 2018
Messages
4,093
Looks like manager code is text. Then you need single quotes around it.
"ManagerCode = '" & Me.AccountManagerInput & "'"
 

LeeHutchins

New member
Local time
Today, 02:38
Joined
Nov 3, 2020
Messages
13
Looks like manager code is text. Then you need single quotes around it.
"ManagerCode = '" & Me.AccountManagerInput & "'"
You are fantastic, thank you! This one has been bugging me for a while, its always something so darn simple.

help is very much appreciated, thanks again!
 

Users who are viewing this thread

Top Bottom