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...
.. 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...
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...
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.
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])...
[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...
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.
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 =...
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...
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"...
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...
StrValue = DLookup("[English]","LanguageTable","[German]=German")
Except for Null in the data field German, the criteria German=German will be true for every record. ;)
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...
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 =...
1 / 2026 = 4.93583415597236E-04 ;)
Dim NewDateFrom as Date
NewDateFrom = DateSerial([txtY], 1, 1)
Dim strSQL As String
strSQL = "UPDATE tblCurentPastYears SET DateFrom = " & Format(NewDateFrom, "\#mm\/dd\/yyyy\#") & _
" WHERE DateFrom is Null;"
A side note: If nobody cared about the numeric value of True in Access queries and simply wrote True, queries on SQL Server tables linked via ODBC would also work.
Select ... From LinkedServerTable where BitDataField = True
This ensures that a Boolean/Bit data type is transmitted instead of a...
[Slightly off topic]
Note: The sa password is saved directly in the application or unlocked with it ... the cracker's heart laughs. ;)
Windows authentication is not wanted?