I regret having to write such a vague question, but I'm not really sure what to try. I have general programming experience, but no access to the source code for this and not a lot of experience with VB/.NET
We have a custom (Read: Crappy) CRM software we use at work that was written ~2008 by someone who has long since left the company. It works on both Windows 7 and Windows 10 just fine for multiple users. I am trying help a user with an "Unexpected program error":
"frmMain - FillGridTable
Conversion from string "03/31/2016 15:23:22" to type 'Date' is not valid."
when I close the dialog box it just says "LoopX = 0"
I do not have access to the source code, and regardless, it works on every other computer.
Could this be some issue with some type of library on the computer? Is there any way to check versions between computers for .NET/Microsoft libraries?
Thanks for any ideas!
Chase Rocker helped me get here in the comment he left on the question.
The windows date/time format settings were displaying a date that wasn't in the correct format. Resolved this by changing it to the MM/dd/YYYY format the error was suggesting the program expected.
I'm glad to see that you solved the issue by changing the computer's regional settings, but to be honest this is probably overkill for what you're wanting to do. Instead, you could have used the DateTime.TryParseExact function.
Here is a quick example of utilizing the built-in method:
Dim conversion As DateTime
Dim input As String = "11/30/2017"
If DateTime.TryParseExact(input, "MM/dd/yyyy", New CultureInfo("en-US"), DateTimeStyles.None, conversion) Then
'Converted successfully
Else
'A true conversion error occured
End If
Fiddle: Live Demo
I'm trying to call this VBA function in the following update query and I'm getting this error. I'm stuck and I don't know what to do. The function signature seems ok to me.
Compute([ep].[ReferenceNumber],[ep].[ITU3Number],[ep].[AuthorizationNumber],[ep].[Ent],[ep].[Indicator],[ep].[LineCode],[ep].[ProductLinee],[ep].[Inp_ProfitCenterCode],[ep].[Inp_ParisBOCode],[ep].[StartDate],[ep].[EndDate],[ep].[ExtractionDate],[ep].[OffBalance],[ep].[IType],[ep].[Counterparty],[ep].[WAL],[ep].[Inp_BackupLineIndicator],[ep].[Indicator],[ep].[FinalRating],[ep].[Amount],[ep].[Currency],[ep].[Historical],[ep].[rice],[ep].[MaturityIndicator],[ep].[pproachType],[ep].[SignatureDate],[ep].[IMaturityDate],[ep].[ProductType],[ep].[Inp_StepupDuration],[ep].[ProbabilityOfStepup],[ep].[SCF],[ep].[ICollateralSCF],[ep].[MobilFlag,[ep].[MarginBp],[ep].[ExtensionCode],[ep].[ExtensionYear],[ep].[UsageType],"a","a")
The expression is too long for Access to process:
The maximum acceptable length appears to be around 560 characters The maximum number of arguments seems to be 29.
For example, by truncating some fields, this works:
Compute([ep].[ReferenceNumber],[ep].[ITU3Number],[ep].[AuthorizationNumber],[ep].[Ent],[ep].[Indicator],[ep].[LineCode],[ep].[ProductLinee],[ep].[Inp_ProfitCenterCode],[ep].[Inp_ParisBOCode],[ep].[StartDate],[ep].[EndDate],[ep].[ExtractionDate],[ep].[OffBalance],[ep].[IType],[ep].[Counterparty],[ep].[WAL],[ep].[Inp_BackupLineIndicator],[ep].[Indicator],[ep].[FinalRating],[ep].[Amount],[ep].[Currency],[ep].[Historical],[ep].[rice],[ep].[MaturityIndicator],[ep].[pproachType],[ep].[SignatureDate],[ep].[IMaturityDate],[ep].[ProductType],[ep].[Inp_StepupDuration])
This works:
Compute(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29)
But this fails:
Compute(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30)
So, you could do something like this:
Compute(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,SubCompute(29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56))
This post is related to a post before this one :
RFID Programming With VB.NET
Thanks for the answer Mark, i already change those to integer (because it doesnt match when port as long but the dc_init as Integer) i decided to change everything with Integer. And it works.
Now, i'm having another problem.
After the dc_init works (after i change those datatype to integer) i'm having a problem when calling dc_cards function.
For further information about the dc_init function i also include the manual file (from the RFID starter pack)
Here is the things that you need to see :
Download
I'm sorry i can't explain more specific about this problem, because i can't post images and only 2 link that i can include. Maybe it would help by downloading those thing above. It includes my project in VB.NET, and the VB6 example program (it works and no bug at all), the dcrf32.dll file (copy them to system32 the driver for RFID).
I'm doing this in VB.NET according to VB6 sample program (from the starter pack), but it's kind of difficult since migrating VB6 to VB.NET.
i really strange with this code, i never learn it and i don't know what to do. Maybe Mark could help me further in my situation.
Thanks a lot.
The Declaration for the dc_card Function should be:
Declare Auto Function dc_card Lib "dcrf32.dll" (ByVal icdev As Integer, ByVal mode as Short, snr As Integer) As Short
You should be passing the icdev you got from the dc_init function, and the mode of 0, your information will be in the snr variable and the status will be in st.
st = dc_card(ByVal icdev, cardmode, snr)
in your declares:
Dim snr, tagtype as Integer
Dim cardmode as Short
...
I designed a query in SQL View using MS Access:
select floor(num1) from t1;
When I run it, I get "undefined function floor".
I get similar errors for Ceil, Mod,Power, Sign, Sqrt, Trunc, and initcap functions.
Does the Access database engine's SQL syntax have equivalent functions?
Replace Floor() with Int(). I learned this by searching in the Access help files, in this case, hitting F1 while in the query designer, and searching for "functions." That took me to a help topic comparing VBA and T-SQL functions.
You should probably have a look at the Access database engine SQL Reference. I can't find a good online reference for functions that are supported through the Jet/ACE and Access expression services. For some unknown reason, the Access Help has not included Jet/ACE expressions since Jet 3.0 and this aged resource was finally removed from MSDN a year or two ago :(
Keep in mind that the Jet/ACE expression service for use outside Access supports a much smaller subset of functions that is possible using the Access Expression Service when running your SQL inside Access 2007. Broadly speaking, the VBA5 functions (as distinct from methods) that involve simple data types (as distinct from, say, arrays or objects) are supported outside of the Access user interface; for an approximate list of function names see the 'Use Sandbox mode operations with Jet 4.0 Service Pack 3 and later' section of this MSDN article.
Also, the functions reference in the VBE help should be a starting place.
The help files are not perfect, but a little searching ought to get you what you need.
Public Function Floor(ByVal x As Double) As Double
'Be Because VBA does not have a Floor function.
'Works for positive numbers
'Turns 3.9 -> 3
'Note: Round(3.9) = 4
Dim s As String, dPos As Integer
s = CStr(x)
dPos = InStr(s, ".")
Floor = CLng(Left(s, dPos - 1))
End Function
As mentioned, Floor isn't available in access, you should use int() as an alternative. If you insist on using Floor, you could always create a vba module function in your mdb file similar to below but that is probably overkill.
Public Function floor(dblIn As Double, dec As Integer) As Double
decPosition = InStr(Str(dblIn), ".")
x = Left(dblIn, decPosition + dec - 1)
floor = x
End Function
Similar to the other math operations you described above you may create additional functions to create this set of functionality.