Search results

  1. J

    Very odd VBA error when using Split()

    The use of the (VBA) Split function is perhaps unusual, but correct. (Without defined Delimiter parameter " " is used.) If the compiler error is not marked, the VB project could be “confused”, then decompile would help. Of course, create a backup first.
  2. J

    Update query doesn't like value formatted for a different region.

    Double is used in the example to show that the value is a decimal number (a floating point number, to be precise). All data types other than string must be converted to a string when concatenating a string. If this conversion is not explicitly specified, it is (unfortunately) implicit in VBA...
  3. J

    Update query doesn't like value formatted for a different region.

    A few examples with the familiar problems: Private Sub BasicPrinciples() Dim SqlCriteria As String ' ' convert numeric values to a SQL string ' -------------------------------------- SqlCriteria = "NumericField = " & 5 Debug.Print """NumericField = "" & 5 =>"...
  4. J

    Update query doesn't like value formatted for a different region.

    SQL is correct now. If 4,25 ist shown in table, this is also correct, because, is the decimal separator. String * Numeric = ? => implicit conversion (with decimal comma in Windows settings): CDbl("4.25") * 1 = 425 * 1 = 425 CDbl("4,25") * 1 = 4.25 * 1 = 4.25 Str(..) is to convert a number into...
  5. J

    Update query doesn't like value formatted for a different region.

    .. Because you use a decimal point instead of a decimal comma in Windows settings. If , is set as decimal separator in Windows: Dim strSQL as String dim dblODJobRate as double dblODJobRate = 4.25 strSql = "UPDATE [Order Details] SET ODJobRate = " & dblODJobRate Debug.Print strSql ' => Output...
  6. J

    RunTime error 2471 with DLOOKUP

    @The_Doc_Man: deprecated in VB.NET. ;)
  7. J

    RunTime error 2471 with DLOOKUP

    Do I understand you correctly: This text "Text, Text, Text" " & vbNewLine & vbNewLine & "Text" can be read exactly like this in the text field of the table? Then it is also displayed in exactly the same way in the message text. vbNewLine is then just a text. Why is it stored like this? The text...
  8. J

    Update query doesn't like value formatted for a different region.

    Maybe this description will help: https://codekabinett.com/rdumps.php?Lang=2&targetDoc=vba-sql-string-tutorial /edit: Perhaps a look at the example application Northwind 2 will also help. In NW2, the StringFormatSQL function is responsible for converting values into SQL text.
  9. J

    Compile error again

    Tip: First create an SQL statement in a single string. Then add the variable values from VBA. Then you can immediately see which change raise a syntax error. First the cumbersome version: 1. strAppSQL = "INSERT INTO SalesTransactionItemsTB ([ItemPurchased],[ItemQTYpurchased],[RetailitemPrice])...
  10. J

    Update query doesn't like value formatted for a different region.

    Use Str(...) SqlText = "UPDATE [Order Details] SET ODHaulageRate = " & CStr(1.2345) & " Where ..." Debug.Print SqlText ' => 1,2345 SqlText = "UPDATE [Order Details] SET ODHaulageRate = " & Str(1.2345) & " Where ..." Debug.Print SqlText ' => 1.2345 BTW: @MajP: one minor fix in CSql: remove C...
  11. J

    Problem with Search Boxes

    [OT] However, you can also set the Form.Filter property, as this forwards the criteria to the SQL Server in the same way and only the requested data is transferred. The statement that all data records are retrieved from the server and only then filtered in Access cannot be confirmed in the SQL...
  12. J

    A dream: What I do miss about Access.

    They did not develop the add-in any further. The Access object options are still available. However, the locks don't fit distributed VCS, so I hope they don't reuse that with the Git integration.
  13. J

    control variable

    I have another example of entering a calculation in a TextBox control with a helper class. Code in form: Private m_CalcTextBox As CalculationTextBox Private Sub tbQty_GotFocus() Set m_CalcTextBox = CalculationTextBox(Me.tbQty) End Sub Private Sub tbQty_LostFocus() Set m_CalcTextBox =...
  14. J

    Glitch in Replace function / Object Browser documentation

    Correct would be (online documentation + behavior in VBA): Function Replace(Expression As String, Find As String, Replace As String, [Start As Long = 1], [Count As Long = -1], _ [Compare As VbCompareMethod = vbUseCompareOption]) As String vbUseCompareOption = -1 ... this value...
  15. J

    Glitch in Replace function / Object Browser documentation

    Replace without compare parameter depends on the “Option Compare” setting. Option Compare Database ' OR Text Option Explicit Private Sub Test() Debug.Print Replace("A", "a", "x") = "x" End Sub vs. Option Compare Binary Option Explicit Private Sub Test() Debug.Print Replace("A", "a"...
  16. J

    Solved Weird Visual Bug in my Code that Conditionally Hides Columns

    Is HorizontalAnchor possibly set to the right?
  17. J

    A dream: What I do miss about Access.

    It's time to update the VBA editor. In principle, Microsoft already has a suitable basis: the Monaco Editor. However, my hope that Microsoft will come up with optimizations for the VBA editor is close to zero. I have more hope for the project by Wayne Phillips (for me the real "master of...
  18. J

    RunTime error 2471 with DLOOKUP

    StrValue = DLookup("[English]","LanguageTable","[German]=German") Except for Null in the data field German, the criteria German=German will be true for every record. ;)
  19. J

    Solved Need help with before update code logic?

    Is it bad if the test is carried out twice? Private Sub CancelBtn_Click() If Me.Dirty Then Me.Undo End If DoCmd.Close acForm, Me.Name End Sub Private Sub CloseBtn_Click() If Me.Dirty Then If Not IsValidData Then Exit Sub End If End If DoCmd.Close...
  20. J

    OpenQuery and TransferSpreadsheet?

    Perhaps the variant via ADODB runs faster. Tested with Northwind 2: 29 tables .. export time: ~1 sec Private Sub ExportTablesToExcelWithADODB() Dim ExcelFile As String Dim ConnectionString As String Dim cnn As ADODB.Connection Dim InsertIntoSql As String ExcelFile =...
Back
Top Bottom