From: Douglas J. Steele on
If by creating a module and adding that line you're talking about putting
the declaration into a second module (i.e. not the module in which the rest
of your code is running), I'd suggest you solved the symptom but not the
problem.

A large part of the problem trying to help you is that you're only giving
little snippets of code without any context. How are you currently running
the code? Your declaration should likely be in that procedure.

--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
Co-author: Access 2010 Solutions, published by Wiley
(no e-mails, please!)

"Bob H" <bob(a)despammer.com> wrote in message
news:HaedneSFlOPdTpbRnZ2dnUVZ7rOdnZ2d(a)giganews.com...
> On 06/06/2010 17:21, Bob H wrote:
>> On 06/06/2010 16:32, Bob H wrote:
>>> On 06/06/2010 14:48, Douglas J. Steele wrote:
>>>> Have you declared lngMyEmpID in your code?
>>>>
>>>> I.e. do you have the following statement anywhere?
>>>>
>>>> Dim lngMyEmpID As Long
>>>>
>>
>> Apologies, I missed out the square brackets, but the error is still the
>> same.
>>
>>> I didn't actually, thanks.
>>>
>>> But now I get another Runtime error '2471':
>>> The expression you entered as a query paramter produced this error:
>>> IngMyEmpID
>>>
>>> And when I debug, this is highlighted:
>>>
>>> If Me.txtPassword.Value = DLookup("strEmpPassword", "tblEmployees", _
>>> "[lngMyEmpID=]" & Me.cboEmployee.Value) Then
>>>
>>> Thanks
>>
>
> I have just found that I need to create a module and put this line in it
>
> Public lngMyEmpID As Long
>
> So when that is done how does it link to the form or button.
>
> Thanks