Anyone know why now in Access 2010 LngEmployeeID = 0 doesn't work? (1 Viewer)

YNWA

Registered User.
Local time
Today, 13:26
Joined
Jun 2, 2009
Messages
905
Hi,

I had a database created in 2003, the VBA that pulls the first problems when I try to open the form in 2010 is...

Private Sub Form_Load()
LngEmployeeID = 0
Me.CboEmployees.SetFocus
End Sub

Brings back a compile error saying it can not find project or library.

The part in questions seems to be LngEmployeeID = 0.

This also pops up in the VBA in this after update:

Private Sub CboEmployees_AfterUpdate()
Me.TxtNI = Me.CboEmployees.Column(2)
Me.TxtBand = Me.CboEmployees.Column(3)
Me.TxtPensionRate = Me.CboEmployees.Column(4)
Me.TxtPCT = Me.CboEmployees.Column(5)
Me.TxtID = Me.CboEmployees.Column(0)
Me.NonCont = Me.CboEmployees.Column(6)
LngEmployeeID = Me.TxtID
GetHistory

End Sub

I am using a form to select employees then enter payment information for them, this is then saved/submited to a query/table and I run queries to calculate how much tax, pension etc... they pay.

Does anyone have any ideas?

Thanks
Will
 
I don't have time to look at files at the moment. When you compiled did it throw up any errors?
 
Yea the one I mentioned and a Format error on another form.
 
What is the exact error message? And does it highlight any line of code?
Where did you place the code?
 
I get this message when I try opening the form for the first time.

See attached.
 

Attachments

  • screen.jpg
    screen.jpg
    87 KB · Views: 132
You're misunderstanding me. Do you get an error when you Debug and Compile?
 
Yes, cannot find project or library error.

This is hightlighted...

Private Sub Form_Load()
LngEmployeeID = 0
Me.CboEmployees.SetFocus
End Sub

Brings back a compile error saying it can not find project or library.

The part in questions seems to be LngEmployeeID = 0.

This also pops up in the VBA in this after update:

Private Sub CboEmployees_AfterUpdate()
Me.TxtNI = Me.CboEmployees.Column(2)
Me.TxtBand = Me.CboEmployees.Column(3)
Me.TxtPensionRate = Me.CboEmployees.Column(4)
Me.TxtPCT = Me.CboEmployees.Column(5)
Me.TxtID = Me.CboEmployees.Column(0)
Me.NonCont = Me.CboEmployees.Column(6)
LngEmployeeID = Me.TxtID
GetHistory

End Sub
 
Have a look at the ticked references for the word "MISSING" and untick it, then OK. Tools > References. Then Debug > Compile afterwards.

Also tell me what references are ticked.
 
Done that but dont understand it.

If I attach could you have a gander?

Take a look at the First two lines in your Module. Do they look like the two below? I suspect that they do not. You do not show the definition of some of your variables in the sample code. If they are not Global, then they could be contributing to your problem.

If you do not have the two lines below, then copy what you need, compile again, and correct any errors (define any missing variables).

-----------------------------------------------------------------------

Option Compare Database
Option Explicit

-----------------------------------------------------------------------

-- Rookie
 
See attached.

I am lost. The code has Option Explicit in etc...

References was popping up couple of days ago but now doesn't.

Lost. Any help would be great.
 

Attachments

You're not answering our questions or following what we advised. Look at our last posts and try it out and report back. If I had time I would have asked you to upload your db.
 
Right, I've got a few mins now. What are the steps to reproduce the problem?
 
Cheers. I am trying to do what your asking...i think.

Open payments form, error happens. then try selecting from dropdowns etc... more errors.
 
I'm not getting any errors. I've selected items from both drop downs and no errors. The initial prompt was to do with LngEmployeeID not declared.
 
So you get no compile errors?

What version of Access are you using?
 
See attached.

Screen2 is what I see when I open the form.
Screen3 is what I see when I select the Type of Rate drop down menu.

vba knowledge is nil, how do I declare it?

This used to work in 2003, so not sure why it wouldn't be declared?
 

Attachments

  • screen2.jpg
    screen2.jpg
    96.5 KB · Views: 95
  • screen3.jpg
    screen3.jpg
    91.2 KB · Views: 113
confused now.

I opened an older version of this db, i got the reference list pop up and it was the microsoft calander 11.0 or something that was missing. So i unchecked it and form works now, except when I click submit I get an error like this...

I did have a pop up calander but I removed it and the code from the first db posted.
 

Attachments

  • screen5.jpg
    screen5.jpg
    93.3 KB · Views: 99

Users who are viewing this thread

Back
Top Bottom