By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,027 Members | 1,271 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,027 IT Pros & Developers. It's quick & easy.

Type MisMatch Error

P: 2
I have a form that has been used in my office MS Access database for a long time. This form is used by the people to enter thier information into the database. We recently changed this form by deleting some of the input spaces in the form. We felt there is too much information we are getting information from the user and therefore changed the form. All we did was just deleted each of the unimportant spaces by clicking on it. After doing this, once i click on this form now, it gives me a "TYPE MISMATCH" error. I have no clue why does this happen. Can anyone please help me out with this. this form is related to a few tables.

Please feel free to email me at Email Address removed per site rules!

Thanks in advance
Dec 10 '07 #1
Share this Question
Share on Google+
4 Replies


Rabbit
Expert Mod 10K+
P: 12,383
You most likely deleted some input field that is used in VBA code. In this case, since they can no longer input that information, depending on how the default values are set, the value might be null. If it is null, and it's expecting a number or date or text, you will get a type mismatch because you can't compare null in the normal way.

It is bad programming practice on the programmer's part that they forgot to account for the Null values.
Dec 11 '07 #2

P: 2
You most likely deleted some input field that is used in VBA code. In this case, since they can no longer input that information, depending on how the default values are set, the value might be null. If it is null, and it's expecting a number or date or text, you will get a type mismatch because you can't compare null in the normal way.

It is bad programming practice on the programmer's part that they forgot to account for the Null values.
Hi,

So is there a way i can correct this. I dont want that to pop up when i opne that form. Please advise me.

Thanks
Vivek Hariharan
Dec 13 '07 #3

Minion
Expert 100+
P: 108
To rectify this issue you would need a bit of understanding of the various sections of code that might access values from these deleted sections. With that in hand it would be necessary to locate the code blocks accessing the control values and modify them if possible to take a placeholder value that would not return the type mismatch.

Luckily the "No Zero" function in vb can help greatly with this. For instance you might a variable that was returning a null previously to return the number "0" instead by using the followign code.

Expand|Select|Wrap|Line Numbers
  1. me.txtResult = nz(<variable producing null>, 0)
This way if the variable would have thrown a null it will instead produce a "0" and my keep the function from producing the error.

Hopefully this helps

- Minion -
Dec 13 '07 #4

Rabbit
Expert Mod 10K+
P: 12,383
Hi,

So is there a way i can correct this. I dont want that to pop up when i opne that form. Please advise me.

Thanks
Vivek Hariharan
Yes, look through the code and find any references to the fields you deleted. If you're lucky, the programmer didn't use error handling and you can just hit the debug button when the error comes up. Or if he did then he put in a way to track down where the error originated. Otherwise you'll just have to step through the code line by line.
Dec 13 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.