
Quote from s7shanbe on January 29, 2021, 6:34 pmhello
In the Pro database and Access database. The date type field is not supported.
How do I date a field type and search between two dates?
hello
In the Pro database and Access database. The date type field is not supported.
How do I date a field type and search between two dates?
Quote from Gaev on January 30, 2021, 4:09 am@s7shanbe
In the Pro database and Access database. The date type field is not supported.
How do I date a field type and search between two dates?You might store dates in a BigInt field ... and store values as CCYYMMDD ... like ...
19991127
20210214
20200907... leading zeroes for days/months less than 10 are important.
Note: If it is important for the user to see these dates in their native/cultural format e.g. dd/mm/ccyy or m/d/yy etc., you might consider using two fields ... one that is shown to the user (e.g. in the grid) ... and the other to deploy in the sort process ... just have to make sure that the non-visual field is created/changed in sync with the visual one.
Added later ... if I recall correctly, MS Access does not use the Windows Regional Settings when displaying date formats (it only deploys US Date formats) ... if this is still true, you might use a String field for the visual field.
In the Pro database and Access database. The date type field is not supported.
How do I date a field type and search between two dates?
You might store dates in a BigInt field ... and store values as CCYYMMDD ... like ...
19991127
20210214
20200907
... leading zeroes for days/months less than 10 are important.
Note: If it is important for the user to see these dates in their native/cultural format e.g. dd/mm/ccyy or m/d/yy etc., you might consider using two fields ... one that is shown to the user (e.g. in the grid) ... and the other to deploy in the sort process ... just have to make sure that the non-visual field is created/changed in sync with the visual one.
Added later ... if I recall correctly, MS Access does not use the Windows Regional Settings when displaying date formats (it only deploys US Date formats) ... if this is still true, you might use a String field for the visual field.
Quote from PaulJonestindall on February 2, 2021, 3:52 pm@s7shanbe
I don't deal with ACCDB files but using MDB files with DBPro you can only use the DateTime field definition. This can be tricky when searching between dates.
Here's what I do to search in my scheduling program:
:start
DateToNum "[DATEstart]" "m/d/y" "[DATEstartnum]"
DateToNum "[DATEend]" "m/d/y" "[DATEendnum]"
If "[DATEendnum]" "<" "[DATEstartnum]"
AlertBox "" "Invalid Date Range"
GotoLine "end"
EndIf
SetVar "[DATEendnum2]" "[DATEendnum]+1"
NumToDate "[DATEendnum2]" "m/d/yyyy" "[DATEend2]"
SetVar "[DATEtotal]" ""
dbpShowAll "pourschedule" "DATE"dbpQuery "pourschedule" "DATE" "pourdate BETWEEN DateValue('[DATEstart]') AND DateValue('[DATEend2]')"
dbpShowGrid "pourschedule" "DATE" "Rectangle42"
:endUsing the DBPro popup calendar I select my start and end dates. I had to add a day ([DATEendnum]+1) to my end date because for some reason the query would not include data for my selected end date. You may want to experiment with that.
Hope this helps.
I don't deal with ACCDB files but using MDB files with DBPro you can only use the DateTime field definition. This can be tricky when searching between dates.
Here's what I do to search in my scheduling program:
:start
DateToNum "[DATEstart]" "m/d/y" "[DATEstartnum]"
DateToNum "[DATEend]" "m/d/y" "[DATEendnum]"
If "[DATEendnum]" "<" "[DATEstartnum]"
AlertBox "" "Invalid Date Range"
GotoLine "end"
EndIf
SetVar "[DATEendnum2]" "[DATEendnum]+1"
NumToDate "[DATEendnum2]" "m/d/yyyy" "[DATEend2]"
SetVar "[DATEtotal]" ""
dbpShowAll "pourschedule" "DATE"
dbpQuery "pourschedule" "DATE" "pourdate BETWEEN DateValue('[DATEstart]') AND DateValue('[DATEend2]')"
dbpShowGrid "pourschedule" "DATE" "Rectangle42"
:end
Using the DBPro popup calendar I select my start and end dates. I had to add a day ([DATEendnum]+1) to my end date because for some reason the query would not include data for my selected end date. You may want to experiment with that.
Hope this helps.