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

vba knowledge is nil, how do I declare it?
You've been doing this for years... it can't possibly be Nil ;)

This used to work in 2003, so not sure why it wouldn't be declared?
Nothing to do with whether 2007 or 2003. It's prompting you because of the Option Explicit line of code and good programming etiquette requires that you ALWAYS declare your variables:

http://www.cpearson.com/excel/variables.htm
 
You've been doing this for years... it can't possibly be Nil ;)

Nothing to do with whether 2007 or 2003. It's prompting you because of the Option Explicit line of code and good programming etiquette requires that you ALWAYS declare your variables:

http://www.cpearson.com/excel/variables.htm

Haha I know but i really venture this deep into it.

Plus I have spent a few days trying to sort it and I am getting desperate now.
 
You've got the link that explains it all. It's very basic so give it a shot.
 
You've got the link that explains it all. It's very basic so give it a shot.

Cheers the problem I have is this we written by DCrake (rip) so the code he has used such as lngemployeeID = 0, I have no idea of what they are?

Am i declaring this as a string? Variant ?

God dam I need a drinik!
 
It looks like a Long to me but if you get type mismatch errors during runtime, change it to Variant.

Just comment out Option Explicit if you are not sure whwat you're doing.
 
Cheers the problem I have is this we written by DCrake (rip) so the code he has used such as lngemployeeID = 0, I have no idea of what they are?

Am i declaring this as a string? Variant ?

God dam I need a drinik!

Technically you are already defining it as a Variant. When Access has no other definition for a Varible, it defaults to Variant to allow all contexts. I have heard that this can lead to some unexpected issues during procesing, so I always define my variables explicitly.

I agree with vbaInet that a Long is a safe way to define a number whose range your are unsure of.

-- Rookie
 
I'm still lost at this, just can't seem to get it to work.

Anychance of cashing in a favour? In return for some discount on my menswear store? ha
 
You're not showing us any effort with respect to all the suggestions we've made. We would like to see what action you've taken following our suggestions and links provided.
 
I can't find "LngEmployeeID"

Does it exist? :confused::confused:
 
If you know so little of VBA why are you not using Bound Forms.

Actually why would you ever consider using unBound. This is MS Access and that is what it is designed to do. USE BOUND FORMS and delete all that VBA stuff that you don't understand.

When I started learning I was told never to use code that I did not have at least a reasonable understanding of.
 
@RainLover: Apparently he was given the solution from late DCrake and now he's copied the code across to another form. All he now needs to do is declare the variable. The most basic thing.
 
@RainLover: Apparently he was given the solution from late DCrake and now he's copied the code across to another form. All he now needs to do is declare the variable. The most basic thing.

He needs to do a lot more than that.

He hasn't even declared the Data types in his Tables correctly.

Once he solves the current problem if he ever does he will have another and another.

If he uses Bound Forms like Access was designed to do he might stand a chance. But using code at his level is simply the wrong approach.

What possible advantage could there be in using UnBound Forms.

I would not do it except on very rare and special circumstances.
 
Much more than envisaged then.

The main advantage of using an unbound form is having total control, but one will need to know exactly what they're doing in order to use them to their full gain. I mostly use unbound forms.
 
The main advantage of using an unbound form is having total control,

Total Control? I don't think so. Why would you think that?
 
I'm not in a position right now to tell you all the advantages because I've not touched Access in a very long while. But I'm sure this has been discussed before.
 
I'm not in a position right now to tell you all the advantages because I've not touched Access in a very long while. But I'm sure this has been discussed before.

I don't need all the advantages, just one demonstrating more control would do.

I am sure that with over 18,000 posts you would have examples at your finger tips.

But never mind. I am asking for something that does little except to create a long winded debate. I don't think either of us want to go there.

I have had sufficient for today. Bed time for me.
 
But never mind. I am asking for something that does little except to create a long winded debate. I don't think either of us want to go there.
Which is what I'm avoiding. ;) Perhaps you can create a new thread for people to debate about this.

Nighty night Rain.
 
Sorry for the trouble. I will work on this tonight and detail my progress.

The reason i am using this is because DCrake provided it for me to calculate and "store" payments made to GP's. To take various calculations such as pension rate, tax et.c.. into consideration.

I want to transfer this way of doing things over to a new database that will allow a user to input figures for energy consumption, then have those figures calculated by a usage rate and other variables.

Then give the user someone to "Submit" the invoice to the database so its easily viewable.

I have asked around for easier solutions, but I thought this was the best bet due to the amount of unbound fields needed in calculating the invoices.

Do you have a better solution for what I am looking to do?

cheers for your input.
 

Users who are viewing this thread

Back
Top Bottom