You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Subtest2()
Dim d AsNew Dictionary
Dim s AsString
d.Add CDate("21.02.2025"), "test"
d.Add CDate("22.02.2025"), "test2"
s = LibJSON.Serialize(d) ' result: {}End Sub
I've deleted my previous comment. No need to know the region settings. I can replicate. The correct call is: s = LibJSON.Serialize(d, forceKeysToText:=True)
JSON format requires string keys, and so by default, any other type is rejected. There is also the failIfNonTextKeys option. Please see Serializer Options
Since the Date data type can be represented as a String in the native VBA, why not automatically represent it without passing parameters, by default?
BTW: Can I send you a video of an interesting (yet another) Access VBA bug that I can't figure out?
There must be something confusing the compiler. Do the following replacements make it work?
Dim RowSyncTypeID As Long. VB* implicitly uses 4-byte integer under the hood for a loop
strSql = strSql & "SELECT...". There is an = instead of & in your example.
Also, what is cGetRows? Is that a function or a global variable? What data type?
Is EMessageType a class or a struct? Is it from the same project or remote?
There must be something confusing the compiler. Do the following replacements make it work?
Dim RowSyncTypeID As Long. VB* implicitly uses 4-byte integer under the hood for a loop
strSql = strSql & "SELECT...". There is an = instead of & in your example.
Also, what is cGetRows? Is that a function or a global variable? What data type? Is EMessageType a class or a struct? Is it from the same project or remote?
Dim RowSyncTypeID As Long - It won't help, because the code will terminate with an error on a specific line. I showed a piece of code cut out from a large function. In the original function, at the Next operator, a random number is added to the variable, for example, 38, 46, 161, etc.
This is a transfer error; in fact, the string strSql = strSql & “SELECT...” does not solve the problem.
cGetRows part of the Enum
' @description Query method response mode in the cls_Database classEnum EDatabaseQueryResultMode2
cNone ' no mode
cGetRows ' array by GetRows
cFirstColumnAsKeyArray ' array where the first column is the key in the array
cFirstColumnAsKeyDictionary ' dictionary where the first column is the key in the dictionary
cFirstColumnAsKeyFastDictionary ' dictionary where the first column is the key in the fast dictionary
cGetRowsAsDictionary ' array of strings represented as a dictionary
cGetRowsAsFastDictionary ' array of strings represented as a fast dictionary
cOnlyFirstColumnAsArray ' array of data from the first column only
cGetRowAsTwoDimensionArray ' array by GetRows, where the row is a separate array
cGroupRowsByFirstColumn ' grouping by the first columnEnd Enum' @description log typesEnum EMessageType
cInfo
cWarning
cError
End Enum
cls_Logger and EMessageType - references project the same folder as main
In the original function, at the Next operator, a random number is added to the variable, for example, 38, 46, 161, etc.
A, ok. This must be a similar stack overlap issue like the ones I fixed for the Dictionary class. This means the issue is somewhere in the sendQuery method of the cls_Database class. To confirm just comment out the code in sendQuery and see if the issue still occurs.
In the original function, at the Next operator, a random number is added to the variable, for example, 38, 46, 161, etc.
A, ok. This must be a similar stack overlap issue like the ones I fixed for the Dictionary class. This means the issue is somewhere in the sendQuery method of the cls_Database class. To confirm just comment out the code in sendQuery and see if the issue still occurs.
But only official language constructs are used there. Is there any way to fix this? Commenting out the line helps, but it turns out that you can't use functionality from another project.
No idea if there is a fix. Would you be able to create a minimal example that I can replicate?
Alternatively, inside the sendQuery method, start commenting lines to narrow the issue. It could be that there is a default property call somewhere. E.g. Collection(3) instead of Collection.Item(3) but on VB class.
Не знаю, можно ли это исправить. Не могли бы вы создать минимальный пример, который я смогу воспроизвести?
В качестве альтернативы, начните комментировать строки внутри sendQueryметода, чтобы сузить область поиска. Возможно, где-то есть вызов свойства по умолчанию. Например, Collection(3) вместо Collection.Item(3), но в классе VB.
In general, the problem is in the return type. If I copy it and create a new method that returns the copied type, everything works. With the original type, there's a funny thing. This does not work even with an empty body and method parameters.
' database response to SQL query in class cls_DatabasePublicType TDatabaseQueryResult
isCorrect AsBoolean' correct response or error
info AsString' error information
resultMode AsEDatabaseQueryResultMode' mode in which the result was received
columnNames AsScripting.Dictionary ' table column names
result AsVariant' resulting selection
Count AsLong' number of records returned
query AsString' sql query
getRows AsVariant' data from Recordset using the GetRows methodEnd TypePublicType TDatabaseQueryResult2
isCorrect AsBoolean' correct answer or error
info AsString' error information
resultMode AsEDatabaseQueryResultMode' in which mode the result was obtained
columnNames AsScripting.Dictionary ' table column names
result AsVariant' resulting selection
Count AsLong' number of records returned
query AsString' sql query
getRows AsVariant' data from Recordset using the G methodEnd Type
Does this solve the problem? Replace: dbRes = dbConnect.sendQuery(strSql, cGetRows)
with AssignUDT(dbRes) = dbConnect.sendQuery(strSql, cGetRows)
where you have the additional:
Does this solve the problem? Replace: dbRes = dbConnect.sendQuery(strSql, cGetRows) with AssignUDT(dbRes) = dbConnect.sendQuery(strSql, cGetRows) where you have the additional:
Private Property Let AssignUDT(ByRef udtLeft As TDatabaseQueryResult, ByRef udtRight As TDatabaseQueryResult)
udtLeft = udtRight
End Property
Activity
cristianbuse commentedon Oct 10, 2025
I've deleted my previous comment. No need to know the region settings. I can replicate. The correct call is:
s = LibJSON.Serialize(d, forceKeysToText:=True)JSON format requires string keys, and so by default, any other type is rejected. There is also the
failIfNonTextKeysoption. Please see Serializer OptionsYamadaHideki commentedon Oct 10, 2025
Since the
Datedata type can be represented as aStringin the native VBA, why not automatically represent it without passing parameters,by default?BTW: Can I send you a video of an interesting (yet another) Access VBA bug that I can't figure out?
cristianbuse commentedon Oct 10, 2025
Because this can lead to unwanted behaviour. Plus, most serializers out there do not implicitly cast to string because it's too dangerous.
Please do. Thanks!
YamadaHideki commentedon Oct 10, 2025
Sended on the email
YamadaHideki commentedon Oct 13, 2025
@cristianbuse It seems that my letter is going to spam.
cristianbuse commentedon Oct 13, 2025
@YamadaHideki Yeah. I saw that on Friday evening but had no time this weekend. Will have a look today and let you know.
cristianbuse commentedon Oct 13, 2025
There must be something confusing the compiler. Do the following replacements make it work?
Dim RowSyncTypeID As Long. VB* implicitly uses 4-byte integer under the hood for a loopstrSql = strSql & "SELECT...". There is an=instead of&in your example.Also, what is
cGetRows? Is that a function or a global variable? What data type?Is
EMessageTypea class or a struct? Is it from the same project or remote?YamadaHideki commentedon Oct 13, 2025
Dim RowSyncTypeID As Long- It won't help, because the code will terminate with an error on a specific line. I showed a piece of code cut out from a large function. In the original function, at the Next operator, a random number is added to the variable, for example, 38, 46, 161, etc.strSql = strSql & “SELECT...”does not solve the problem.cGetRows part of the Enum
cls_LoggerandEMessageType- references project the same folder as maincristianbuse commentedon Oct 13, 2025
A, ok. This must be a similar stack overlap issue like the ones I fixed for the
Dictionaryclass. This means the issue is somewhere in thesendQuerymethod of thecls_Databaseclass. To confirm just comment out the code insendQueryand see if the issue still occurs.YamadaHideki commentedon Oct 13, 2025
But only official language constructs are used there. Is there any way to fix this? Commenting out the line helps, but it turns out that you can't use functionality from another project.
cristianbuse commentedon Oct 13, 2025
No idea if there is a fix. Would you be able to create a minimal example that I can replicate?
Alternatively, inside the
sendQuerymethod, start commenting lines to narrow the issue. It could be that there is a default property call somewhere. E.g. Collection(3) instead of Collection.Item(3) but on VB class.YamadaHideki commentedon Oct 14, 2025
In general, the problem is in the return type. If I copy it and create a new method that returns the copied type, everything works. With the original type, there's a funny thing. This does not work even with an empty body and method parameters.
cristianbuse commentedon Oct 14, 2025
Does this solve the problem? Replace:
dbRes = dbConnect.sendQuery(strSql, cGetRows)with
AssignUDT(dbRes) = dbConnect.sendQuery(strSql, cGetRows)where you have the additional:
YamadaHideki commentedon Oct 14, 2025
Nope(
cristianbuse commentedon Oct 14, 2025
I cannot recreate unfortunately. Do you think you can create a minimal example?