472,358 Members | 1,770 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,358 software developers and data experts.

Type mismatch problem

Hello Guys,

I have a form wherein if the value of lstatus (which is a combo text field input) is say "c" and another field named n_days which is a number field is greater than figure three (3)then I spit a message box.
I have done so with the code below on Before Update of the form:

Expand|Select|Wrap|Line Numbers
  1. If ((lstatus.Value = "C") And (n_days.Value > 3)) Then
Although it works once the conditions are satisfied, I get an error which says type mismatch when I try to refresh the form data or clear the form and set all values to Null ("").

My VB is weak! What is the problem with my code?
Kindly help.

Warm Regards
Aug 31 '13 #1
1 1216
5,501 Expert Mod 4TB
You've really not provided enough to work with however, the most common issues with null vs empty are:

Nulls may not be used with a string datatype.

Nulls may only be used with the variant datatype.

"" is an empty string
Null is null... an undefined entry
The two are not interchangable.

You might look at the NZ() function.

You should also take a read thru Allen Browne Tutorial - Common Errors with Null
Sep 1 '13 #2

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

Similar topics

by: Arun Wadhawan | last post by:
Hello MY SQL Server is causing me this problem : Microsoft VBScript runtime error '800a000d' Type mismatch: 'ident' >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> I am getting from...
by: Faz | last post by:
Even after changing Invoice_ID to Clng(Invoice_ID) and trying to link to the Reference_2 field which is text it is giving me a type mismatch error. So I created a new query in access where I...
by: Søren M. Olesen | last post by:
Hi I starting to get the following compiler error, but I really don't know how to resolve it. Value of type 'DXP.Shared.myPath' cannot be converted to 'DXP.Shared.myPath'. Type mismatch...
by: vishwaskothari | last post by:
What is wrong in the following Statement? Dim mydate As Date Format(mydate, "m/d/yy") rs.Open "SELECT * from accounts where date='" & mydate & "';", con, adOpenStatic, adLockOptimistic
by: THEAF | last post by:
i'm using this for my list box: Private Sub lstStock_Click() ' rsMyRS.FindFirst "Stockcode=" & Str(lstStock.ItemData(lstStock.ListIndex)) txtCode.Text = rsMyRS!Stockcode optVegi.Value...
by: Lara1 | last post by:
Hi, I'm a total beginner to VBA, so please bear with me if I seem a bit dense. What I'm Trying to Achieve I'm trying to write a procedure in Excel, which is supposed to - look at the pH...
by: THEAF | last post by:
hi, i'm creating a search button. When i click the button an input box shows up where i then enter the name of the employee and the result is show on a list box. Im using vb 6 and access. my form...
by: loisk | last post by:
Hi again, I need to compare two variables of different datatypes, i.e., intvdate is string & strToday is date. The datatype for intvdate is string to avoid any further problem later, and strToday...
by: nckinfutz | last post by:
hello, I am having a problem with an access database. this is not my database and I did not create it, nor am I very good at access. however, I am a network engineer and that is why this problem...
by: crookward | last post by:
I usually have no problem identifying a type mismatch error, but this one's got me pulling my hair out. The mismatch error is pointing to line 269, which is a blank line, and it's also within an if...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.