I am trying to compare two text fields txtTrailerNumber and txtSealNumber to the database table Tab_TrailerDetails. [TrailerNumber] and [SealNumber] as listed in the table. I am trying to get the …
Tag: vba
SQL in Excel: Cannot call declared variable
I am trying to breakdown my SQL string in Excel VBA, storing my variables in the first part of the SQL, and calling them in the second part. It seems that declared variables is not my friend here? First part(Declaring my variable) Second part(Calling my variable) Using a temp table works: But calling the variable doesn’t: Answer In-memory @variables are
Delete record from table if certain fields are empty upon closing a Form
I am trying to get a button to close a Form and at the same time delete records on a table where certain fields are empty. I have this on the Form: AlimentoporTanque is the Table’s name and Tanques and Alimento the fields that should not be empty. When I click on the button I get following MsbBox popping up:
SQL Query with Excel VBA
I’m trying to run a SQL query with Excel VBA. I got the query from someone else. When I run this query, I’m getting the following error message: “The SELECT statement includes a reserve word or an argument name that is misspelled or missing, or the punctuation is incorrect.” I can’t figure out what is wrong (plus I’ve never tried
Using the Like operator with two fields
How do I use the Like operator to join two unidentical tables as below? My main problem is on how to compare the PO filed on tbl2 to the EditNo on tbl1 field. Please see sample tables and expected results below: tbl1: tbl2: Expected: Query: SELECT * FROM tbl2 INNER JOIN tbl1 ON tbl2.PONo LIKE EditNo.PO; Answer You need wildcards:
How do I write my SQL Code in MS Access SQL?
Table Name: Records ID Date Time Status BoxType Material Rack EmployeeNr Transaction 1 25-05-2020 13:11:12 70 36757 4 4 188 2 2 25-05-2020 13:12:40 71 31178 2 5 188 2 3 25-05-2020 13:13:31 71 31178 2 5 188 102 4 27-05-2020 13:14:14 71 38444 3 2 181 3 5 27-05-2020 13:14:15 71 38444 3 2 181 3 6 27-05-2020 13:14:41
Adding new records to Access table on an update to a linked table in Access VBA SQL
I have two table one (skillsMatrix) the other table is (elementTree) with columns [mediumElement], [ID] in table skillsMatrix the mediumElement is a lookup dropdown of the mediumElements in table two. I want to write a macro to update skills matrix table to add a new record “name”, “new topic”,”” and not duplicate any of the other records when a new
Access: Issue Creating SQL View Through VBA – Unions not allowed in subquery
First of all, let me preface this with something I almost always say in my few posts so far, which is that I’m not an IT/tech person. I’m an accountant who likes to dabble a little bit in SQL and so …
How to change SQL queries in Excel using VBA?
I have a workbook connected to a database that has stock data. I have around 500 stock symbol data and I fetch them one by one by entering the stock symbol (pink highlighted) in the query as shown below. All the time I have to open Connection Properties then Definition to change the stock symbol. This process is time-consuming. I
Multiple columns from one column
I track the aging of customer invoices. The below code example returns the balance of customer invoices by customer that are between 0 and 30 days old. However, I want to run one query that pulls separate columns into Excel for each customer’s balance aged between 0 and 30 days, 31 and 60, 61 and 90, and finally over 90