Can complex conditional statements be made in a SQL query?
Here is a more detailed explanation of what I need to accomplish. There are two columns important to the query (A and B). If multiple records have the same value for A, then their B values are relevant. B ranges from 1 to 6.
If...
It would be a simple query, except that I need to eliminate some of the data based on a value. I need to pull from three tables, and in each of these tables is Column A. I need to write code to evaluate the data in Column A, and then delete certain rows that have matching values in Column B...
The information will be sent either to Excel or to Outlook (depening on what the user selects), but I would like to gather the data into a single recordset.
Jon
I am writing a script in VBA which will gather data from multiple Access tables and store them in a single recordset to be transferred to Outlook or Excel. I am using ADO objects.
How do I append more data to a recordset?
Thank you,
Jon
Here is the connection string:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source='\\path\files\folder\database.mdb'"
I use this path succesfully to execute SQL statements with a ADODB Connection object in a different Macro.
Thanks,
Jon
Dim cConn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sSql As String
sSql = "SELECT Table1.Field1,Table1.Field2, Table1.Field3 FROM Table1 WHERE Table1.Field4 = Yes"
Set cConn = New ADODB.Connection
Set rs = New ADODB.Recordset
cConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data...
Thanks PH! Can more than one field be used for the join? So can I set up something like this:
UPDATE Table1 INNER JOIN Table2 ON (Table1.FieldY = Table2.FieldY) AND (Table1.FieldX = Table2.FieldX)...
?
Thanks!
UPDATE Table1 SET Table1.FieldX = TRUE WHERE (Left(Table2.FieldY,3) = '000') AND (Right(Table2.FieldZ,7) = Right(Table1.FieldZ,7))
Will this work? Do I need to use a JOIN statement to test the fields from each record in Table2?
Thanks!
I need to compare two identical (in terms of design) tables, and then take an action depending on the comparison. To be more specific, I need to take FieldX from Table1, and look in Table2 to see if there is a record with a matching value of FieldX.
If there isn't a match, the entire record...
I did not find any files with those names. I know how to use a ADODB object to create and open a connection to an Access database, I am just not sure what object to use to connect to a different type of database. Like I said, I have the connection string (which specifies ODBC), and the SQL...
I need to open an ODBC connection to a database. I have the connection string (I used the record macro feature to find it), but I don't know what object or syntax to use. I have an update query written in SQL that I need to execute on the databse from the macro. Can anyone give me a code example...
Okay, next issue here:
I need to perform the Update Query on multiple tables in the same DB. Should I just use multiple execute statements with the same Connection object, or is there a way to write the Update SQL so it performs the update in multiple tables?
Thanks!
J
Okay, here is my code:
<code>
Sub RemoveFax(sAreaCode As String, sFaxNum As String)
Dim cConn As ADODB.Connection
Dim sSQL As String, sConn As String, sDB As String
Dim lCount As Long
Dim sFaxRem As String
sFaxRem = sAreaCode & sFaxNum
'Instantiate the...
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.