UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Ms Access Datatype Missmatch, Access 2016    
 
   
marinko888
post Jul 31 2020, 12:24 PM
Post#1



Posts: 130
Joined: 9-April 19
From: Croatia


Hi,

on my PC there is no Datatype Missmatch Errors but on a Deploying PC there is one:

Attached File  Capture.PNG ( 2.18K )Number of downloads: 0


Al DLL References are the same...

How can I resolve this issue!
Any suggestion is welcome.
Go to the top of the page
 
theDBguy
post Jul 31 2020, 12:28 PM
Post#2


UA Moderator
Posts: 78,601
Joined: 19-June 07
From: SunnySandyEggo


How is x declared? What are the values in zbir1 and zbir2?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
marinko888
post Jul 31 2020, 12:40 PM
Post#3



Posts: 130
Joined: 9-April 19
From: Croatia


It is declared right before like this:

Dim zbir1, zbir2 As String

zbir1 value = '31.07.2020. 19:36:45'

zbir2 value = '31.07.2020. 19:40:45'

x= difference in seconds
This post has been edited by marinko888: Jul 31 2020, 12:50 PM
Go to the top of the page
 
FrankRuperto
post Jul 31 2020, 01:19 PM
Post#4



Posts: 1,209
Joined: 21-September 14
From: Tampa, Florida USA


I dont see x being declared. Is x a Long Integer, or a Date/Time like zbir1 and zbir2 ?
This post has been edited by FrankRuperto: Jul 31 2020, 01:21 PM

--------------------
Currently supporting pawnbrokers that use my store management system developed with Access 2010 on Windows7. Experienced with Informix, Oracle & PostgreSQL db's.
Go to the top of the page
 
marinko888
post Jul 31 2020, 01:23 PM
Post#5



Posts: 130
Joined: 9-April 19
From: Croatia


x ha been declared as Single
Go to the top of the page
 
FrankRuperto
post Jul 31 2020, 01:26 PM
Post#6



Posts: 1,209
Joined: 21-September 14
From: Tampa, Florida USA


Single?.. Maybe you mean just an Integer, which in Access can hold a value up to 32,767, or is x a Float?
If x is supposed to be the interval difference in seconds, then I think you have to also define it as a Date/Time.
At least thats how its done in db servers, but Access allows you to use a LongInteger.
This post has been edited by FrankRuperto: Jul 31 2020, 01:32 PM

--------------------
Currently supporting pawnbrokers that use my store management system developed with Access 2010 on Windows7. Experienced with Informix, Oracle & PostgreSQL db's.
Go to the top of the page
 
MadPiet
post Jul 31 2020, 01:30 PM
Post#7



Posts: 3,845
Joined: 27-February 09



You can't do date math on strings. they have to be dates.

zbir1 value = '31.07.2020. 19:36:45'
zbir2 value = '31.07.2020. 19:40:45'

dim startDate As DATE, endDate As Date
dim lngDiffInSeconds long

startDate = CDATE(zbir1)
endDate = cdate(zbir2)

lngDiffInSeconds = DATEDIFF("second",startDate,endDate)
Go to the top of the page
 
marinko888
post Jul 31 2020, 01:33 PM
Post#8



Posts: 130
Joined: 9-April 19
From: Croatia


No, Single which accepts decimal values
Go to the top of the page
 
marinko888
post Jul 31 2020, 01:34 PM
Post#9



Posts: 130
Joined: 9-April 19
From: Croatia


I believe your suggestion is the closest to the solution...
Go to the top of the page
 
MadPiet
post Jul 31 2020, 01:40 PM
Post#10



Posts: 3,845
Joined: 27-February 09



I can't remember the exact syntax for DATEDIFF, but the point I was trying to make is that DATEDIFF works on dates, and what you posted are strings that look like dates. Dates are actually stored as numbers under the covers in Access. I can't remember if the abbreviation is "s" for second... I think so, though.
Go to the top of the page
 
marinko888
post Jul 31 2020, 01:49 PM
Post#11



Posts: 130
Joined: 9-April 19
From: Croatia


Actually, the solution is in the local settings on my PC which differs from that ones on a Deployment PC...

Thank you all for your suggestions!
Go to the top of the page
 
tina t
post Jul 31 2020, 03:10 PM
Post#12



Posts: 6,741
Joined: 11-November 10
From: SoCal, USA


and btw, just as a heads-up:

QUOTE
It is declared right before like this:

Dim zbir1, zbir2 As String

in the above declaration, zbir2 is declared as a String data type. but zbir1 does not have an explicit data type declaration, so it's set as a Variant by default. in VBA, each variable must have an explicit data type declaration; you can't dim more than one in a row and just hang the data type on the end of the row. example

Dim zbir1 As String, zbir2 As String

though i agree with Piet that the variables should be declared as Date data type, rather than String data type. perhaps Access is doing a data type conversion behind the scenes in the DateDiff() function, i wouldn't know. but i also wouldn't count on it - safer to feed date values into the function in the first place, i would think.

hth
tina

--------------------
"the wheel never stops turning"
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    5th August 2020 - 05:03 AM