Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / August 2005

Tip: Looking for answers? Try searching our database.

Type Mismatch Error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
LeAnn - 23 Aug 2005 20:43 GMT
I have an Access 2000 database.  On one of my forms (bound to query) I have 2
date fields  that the users can edit.  When the user clicks SAVE, it calls a
validation procedure that checks a number of criteria for valid dates.  In
that procedure there are 2 string variables declared and set to the date
controls using another procedure that assigns a nullstring if the control is
empty:

strTDate = Nullstring(Me.ThawDte)   ‘set variable early in main procedure

******************
‘Nullstring function statements
If IsNull(varNull) Then
   NullString = ""
Else
   NullString = CStr(varNull)
End If
******************
Later in the validation procedure but fairly early there is:

If strTDate <> “” Then
    More validation statements

I’m getting a type mismatch error on the IF statement when the user clears
the control to delete the value and then clicks save.

I’ve stepped through the procedure and the variable is set to “”.  

The procedure works fine if the user wants to edit the other date and this
control is already empty.  Is there something about “clearing” the control
that is causing the problem?

Any ideas?
Thanks LeAnn
LeAnn - 23 Aug 2005 21:32 GMT
I have read many posts related to this error and found a couple of possible
solutions using Not isNull(control) AND/OR vbNullString for the IF statement
and I still get the error.

> I have an Access 2000 database.  On one of my forms (bound to query) I have 2
> date fields  that the users can edit.  When the user clicks SAVE, it calls a
[quoted text clipped - 29 lines]
> Any ideas?
> Thanks LeAnn
John Vinson - 24 Aug 2005 05:49 GMT
>When the user clicks SAVE, it calls a
>validation procedure that checks a number of criteria for valid dates.

Umm...

You're going to a LOT of extra work.

If Not IsDate(Me!txtDatefield) Then
 <warn the user that it's not a valid date>
End If

                 John W. Vinson[MVP]    
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.