PDA

View Full Version : VBA Error help for MS Access



Pancakes1032
03-31-2015, 05:27 PM
Hello,

I'm having some trouble with my coding. The entire row is not working properly and it saying that the object or method is not valid, but everything is written correctly in the form and the main table as well. I don't know what is wrong. This code works perfectly for another database that I am using and the format is exactly the same. The references are the same as well.

Has anyone else come across this problem before? Please see the screenshots attached.13105

jonh
04-01-2015, 02:00 AM
What is lastname supposed to be? A field or control?
Whatever it is, it doesn't appear to exist. If it's a field, check that it's returned by the forms record source.

Using dot notation (MsgBox Me.lastname) enables intellisense, so as you type, the matching item is highlighted in the list.
If it isn't highlighted it doesn't exist and your project won’t compile. Whereas using a bang (MsgBox Me!lastname) just causes a trappable runtime error.

Pancakes1032
04-01-2015, 05:04 PM
What is lastname supposed to be? A field or control?
Whatever it is, it doesn't appear to exist. If it's a field, check that it's returned by the forms record source.

Using dot notation (MsgBox Me.lastname) enables intellisense, so as you type, the matching item is highlighted in the list.
If it isn't highlighted it doesn't exist and your project won’t compile. Whereas using a bang (MsgBox Me!lastname) just causes a trappable runtime error.

Thank you for the help. I actually figured it out. It wasn't directing me to the right error. I had to check every single control field and found which one was wrong.