These
"SET = ...("SumOfBalls") & _
ARE NOT spaces in the SQL statement. They are a part of the VBA syntax. If you wanted a space there then you would need to explicitly put it in.
"SET = ... ("SumOfBalls") & " " & _
Nor do I.
It just seems wrong to have variable values enclosed in quotes floating around in my code. At best it's confusing and error-prone as in this case.
You already have quotes around the field.
modelNumber = "'" & modelNumber & "'"
and you are adding more of them in the DLookup
Also, your syntax is incorrect. It should be
DLookup("ModelID", "TblModel", "ModelNum=" & modelNumber )
You are missing a comma and a space after billpd as 4 and you have a spurious comma after billpd as 14
Would this be easier?
Public Sub GetData()
Dim strSQL As String
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim iRow As Integer
Dim iCol As Integer
Set db = CurrentDb
iRow =...
First the UPDATE to identify the table, then WHERE to filter the table and finally the SETs.
I assume (but don't know for sure) that the SET clauses are executed in the order presented. In this case it doesn't much matter since all the specified fields are updated when the query completes and...
Try this
qryTblOrderUnit = "SELECT * FROM TblOrderUnit " & _
"WHERE OrderID=" & OrderID & " AND UnitID=" & UnitID
Set tblOrderUnitRS = dbs.OpenRecordset(qryTblOrderUnit)
With tblOrderUnitRS
If .EOF and .BOF Then
strSQL = "INSERT INTO...
That's what I thought ...
A query (which is what you created in the query design wizard) is an SQL statement and it may be used to generate a recordset in VBA by running the query ... HOWEVER ...
Query SQL and a recordset are completely different creatures and you cannot combine one with the...
If your Query Definition SQL is stored as a query (as opposed to being run from VBA) then you need to set up another query (lets call it DetU) with some dummy SQL. Then in your DetermineUnits routine.
Public Sub DetermineUnits(Optional ByVal ViewName as String = "DetU")
Dim cat...
The link I posted pretty much explains how to set up the ODBC DSNs. I'm not an Oracle user but I have a suspicion that the change to 11g may require that you have different DLLs installed on your machine. You may want to check with your Oracle gurus to see if your local machine needs to be upgraded.
Here's one possible issue. If you are declaring API functions then you need to deal with the changes from VBA6 to VBA7 as used on 64-bit systems.
And this is a similar take on it.
Your code looks correct except that I don't see where IniFileName is defined.
I assume that you mean
section = "TRAY"
Keyname = "Paper"
Value = "Letterhead"
That should create a IniFile that looks like
[TRAY]
Paper = Letterhead
I would modify your routine to
Private Function...
Use the WritePrivateProfileString API call. The VB definition is
Public Declare Function WritePrivateProfileString _
Lib "kernel32" Alias "WritePrivateProfileStringA" _
(ByVal lpSectionName As String, _
ByVal lpKeyName As Any, _
ByVal lpString As...
Just need to re-initialize "WriteOption" on each pass through the loop.
'Extracts specified Blob to file.
Private Function ExtractBlobAll(strPath As String) As Boolean
On Error GoTo Err_Handler
Dim strSQL As String
Dim rst As Object...
Gotta be some problem with adTypeBinary and/or adSaveCreateOverWrite. Let's go back to the way you had it.
'Extracts specified Blob to file.
Private Function WriteBinaryFile(varFileBinary As Variant, _
strFile As String) As Boolean...
Assuming that the SQL server tables are linked into Access, the usual way is
INSERT INTO mySQLServerTable (Fld1, Fld2, Fld3, ...)
SELECT FldA, FldB, FldC, ...
From myAccessTable
WHERE ... Some logical Conditions ...
This assumes of course that you are authorized to modify the SQL Server...
Try it this way
Private Function ExtractBlobAll(strPath As String) As Boolean
On Error GoTo Err_Handler
Dim strSQL As String
Dim rst As ADODB.Recordset
Dim cn As ADODB.Connection
Dim strFile As String
Dim...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.