X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
2 Pages V < 1 2  (Go to first unread post)
   Reply to this topicStart new topic
> Run-time Error ‘13’ Type Mismatch, Access 2013    
post Aug 13 2017, 04:18 AM

UtterAccess Editor
Posts: 16,084
Joined: 27-June 06
From: England (North East / South Yorks)


>> **I would really like to update the Final Act value with “Delogged” whether there is a Mailed Date value present or not please.
>> --So if the mailed date is null, drop through the Received Date /vs/ Mailed Date comparison and just allow update to Final Action column

Indeed. You can code defensively, or in a more reactionary way. So checking values before their use makes a lot of sense if they've entirely likely to not have been provided.
Error handling if it isn't is another option, but tends to be more of an entire procedure failure route. (Though isn't necessarily.)
I've heard programming referred to as "If statements and Loops". Seems harsh, and yet the bread and butter (and certainly of getting started) of it.
So If statement away.
If you need a value to be supplied before you use it, check it. (If statement example earlier.) Don't use that value then, or provide a substitute.

Then proceed with the rest of your procedure.

>> I don’t know the apps process at all.
>> I should have talked to a manager or someone else who knew the screen, the key entry person was out Thursday and Friday.

Well, if you don't we certainly don't. ;-)

Best of luck with it.


Go to the top of the page
tina t
post Aug 13 2017, 10:12 AM

Posts: 5,184
Joined: 11-November 10
From: SoCal, USA

and don't forget the most important rule when troubleshooting somebody else's database/application: first, do no harm.


"you can't take the sky from me"
Go to the top of the page
Doug Galayda
post Aug 17 2017, 06:15 PM

Posts: 210
Joined: 19-May 10
From: Springfield, Illinois

Thursday, August 17.th, 2017 615pm

Congratulations LPervis and Tina T, your encouragement, motivation and ideas helped me find out what made the Error(s) generate!

1)The below solved the Final Action Drop Down error

Private Sub cmbFinal_Act_Change() Zero Length String
txtReceived.Locked = False
Dim ReceivedDate As String
ReceivedDate = txtReceived.Text
txtReceived.Locked = True
'changed ReceivedDate = " " to ReceivedDate = Null on next line to resolve Runtime -215 Error Type Mismatch
If (Not cmbFinal_Act.Value = " " And search And Not ReceivedDate = Null) Then <======@ the = Null was the solution!
Dim MAILED As Date
MAILED = DateSerial(Year(txtMailed.Text), Month(txtMailed.Text), Day(txtMailed.Text))
If (MAILED - DateSerial(Year(ReceivedDate), Month(ReceivedDate), Day(ReceivedDate)) >= 0) Then
txtRev_Time.Text = MAILED - DateSerial(Year(ReceivedDate), Month(ReceivedDate), Day(ReceivedDate))
txtRev_Time.Text = 0
End If
End If
End Sub

2) The below solved the Reset button code Error
Then user would update button which would update the database
Then hit a reset button, then say yes to a popup question that the reset code generated:
And the reset code would set all the control/fields on the screen to Nulls
**Then the user would get the message:
“Execution of this application has stopped due to a run-time error”
“the application can’t continue and will be shut down”

I found out I needed to change the variable in the reset code:
Received = “” (Zero Length String) To Received = Null 

Prior to finding out what worked, I tried everything
If Else, if Mailed Date Null, Exit Sub as to not attept update the time field.

#2 Put the original code in a after update event trigger.
That did help, but got a error after the Reset button was hit.
#3 and I tried other things, but what you said about the “zero length string “”
Came to me this morning, and thought, that needs to be null!
And that was the beginning of the solution

**the sqlServer columns were:
ReceivedDate = nvarchar12
MailedDate = nvarchar12
**The Access columns were:
Received is a short text (12 long)
Mailed is a short text (12 long)

So the previous programmer was using date serial to convert the Mailed text to a date
Then if Received was not null, subtract Mailed from the Received (Date)
And the resulting subtracted product was assigned to a Float column.
(and if the Mailed date was null it would get an error)

If I did not get the answer this Thursday morning I was going to change the SQLServer date columns to
DateTime, and change the Access columns to ShortText

Many thanks for telling me what will absolutely not work!
And what to try, such as Exit sub!
And the differences of = “”, = “ ” and = Null
I learned there is a critical difference in = “”, = “ ” and = Null
You are important to me UA team!
Thank you!
This post has been edited by Doug Galayda: Aug 17 2017, 06:39 PM
Go to the top of the page
Doug Galayda
post Aug 17 2017, 06:22 PM

Posts: 210
Joined: 19-May 10
From: Springfield, Illinois

Thanks Tina,
I replied to LPervis,
It took a lot of attempts, but I found the answer.
I tested it on the users computer, and it works.
I am so glad.
Thank you!
This post has been edited by Doug Galayda: Aug 17 2017, 06:30 PM
Go to the top of the page
post Aug 18 2017, 06:48 AM

UtterAccess Editor
Posts: 16,084
Joined: 27-June 06
From: England (North East / South Yorks)


I'm glad you were able to get there.
And yes, the distinction between Null and ZLS is important.

However, just to check, in the textboxes in question, you're wanting a date value - aren't you?
So neither Null nor a ZLS is acceptable.
The suggestion I made much earlier in this thread was to check for a Date.

If Not IsDate(Me.txtMailed) Then

That should have handled both scenarios had it been used. But you're all the wiser now anyway. :-)


Go to the top of the page
2 Pages V < 1 2

Custom Search
RSSSearch   Top   Lo-Fi    22nd November 2017 - 03:28 PM