Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Old 05-21-2012, 07:04 AM   #1
tegb
Newly Registered User
 
Join Date: Feb 2012
Posts: 49
Thanks: 9
Thanked 0 Times in 0 Posts
tegb is on a distinguished road
3421: data type conversion error

I have a textbox on a form for entering date. this field is optional meaning it could be blank. when I leave this field blank & click save to update table (table is not bound to form), I get 3421 data type conversion error. how can i get this field to accept blanks as well as dates? it works perfectly alright when a date is entered

tegb is offline   Reply With Quote
Old 05-21-2012, 07:14 AM   #2
pr2-eugin
Super Moderator
 
pr2-eugin's Avatar
 
Join Date: Nov 2011
Location: Bournemouth, UK
Posts: 8,498
Thanks: 68
Thanked 2,062 Times in 2,012 Posts
pr2-eugin has a spectacular aura about pr2-eugin has a spectacular aura about pr2-eugin has a spectacular aura about
Re: 3421: data type conversion error

could we see the update query that you are using?
__________________
Regards,
Paul Eugin

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
!
Windows 7 Professional, MS Access 2010
---------------------------------------------------------------------------------------------------------------------
If the above post has helped you, please click the scales
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
or click the 'Thumbs up'. Cheers.

---------------------------------------------------------------------------------------------------------------------



pr2-eugin is offline   Reply With Quote
Old 05-21-2012, 07:31 AM   #3
tegb
Newly Registered User
 
Join Date: Feb 2012
Posts: 49
Thanks: 9
Thanked 0 Times in 0 Posts
tegb is on a distinguished road
Re: 3421: data type conversion error

thanks for helping,

I am not using a query, i am using the below code

Dim db As Database
Set db = CurrentDb
Dim tblpool As Recordset
Dim Sixtyplus As Integer
Dim rstemp As Recordset
Dim rstemp2 As Recordset
Dim rstemp1 As Recordset
Dim rstemp3 As Recordset
Dim ctl As Control
tblpool.AddNew
tblpool![Issue1] = Issue1.Value
tblpool![Issue1Resolved] = chkIssue1Resolved.Value
tblpool![Issuecate1] = Issuecate1.Value
tblpool![DefineDate] = DefineDate.Value
tblpool.Update

tegb is offline   Reply With Quote
Old 05-21-2012, 07:49 AM   #4
pr2-eugin
Super Moderator
 
pr2-eugin's Avatar
 
Join Date: Nov 2011
Location: Bournemouth, UK
Posts: 8,498
Thanks: 68
Thanked 2,062 Times in 2,012 Posts
pr2-eugin has a spectacular aura about pr2-eugin has a spectacular aura about pr2-eugin has a spectacular aura about
Re: 3421: data type conversion error

You could use a if condition to check before updsting values.. something like..
Code:
Dim db As Database
Set db = CurrentDb
Dim tblpool As Recordset
Dim Sixtyplus As Integer
Dim rstemp As Recordset
Dim rstemp2 As Recordset
Dim rstemp1 As Recordset
Dim rstemp3 As Recordset
Dim ctl As Control
tblpool.AddNew
tblpool![Issue1] = Issue1.Value
tblpool![Issue1Resolved] = chkIssue1Resolved.Value
tblpool![Issuecate1] = Issuecate1.Value
If Len(DefineDate.Value & "")>0 Then
    tblpool![DefineDate] = DefineDate.Value
Else
    tblpool![DefineDate] = Null
End If
tblpool.Update
__________________
Regards,
Paul Eugin

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
!
Windows 7 Professional, MS Access 2010
---------------------------------------------------------------------------------------------------------------------
If the above post has helped you, please click the scales
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
or click the 'Thumbs up'. Cheers.

---------------------------------------------------------------------------------------------------------------------



pr2-eugin is offline   Reply With Quote
The Following User Says Thank You to pr2-eugin For This Useful Post:
tegb (05-21-2012)
Old 05-21-2012, 08:12 AM   #5
tegb
Newly Registered User
 
Join Date: Feb 2012
Posts: 49
Thanks: 9
Thanked 0 Times in 0 Posts
tegb is on a distinguished road
Re: 3421: data type conversion error

that worked, thank you very much!

tegb is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Data ?Type conversion Error JesseH Queries 4 05-19-2010 08:16 AM
data type conversion error... mfuada Modules & VBA 4 03-17-2009 05:55 PM
Data Type Conversion Error chaostheory Modules & VBA 6 10-01-2008 06:03 AM
Data Type conversion error Nishikawa Tables 1 08-04-2008 01:28 AM
Data Type Conversion Error Little_Man22 Forms 13 11-03-2001 01:20 PM




All times are GMT -8. The time now is 04:57 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World