I can recover data from my database using vba, but I have to add quotes on the result of column (“value1”, “Value2”, “Value3” etc) But I do not know how to add quotes inside the SQL query, when using “…
Tag: vba
Multi-Field Search Button (Query) Showing Records With or Without Missing Fields
I have a database with only 1 table, this table has 27+ fields and not all of them will contain a value (some will be empty). I have a button (“search alarm”) on a navigation form that performs a …
Excel VBA with SQL : No row returned when Where clause specified
Here below an excerpt of my codes. This is the SQL command : Where the database located : The variable containing the string connection to the DB : The wrkSheet for the result : This command Adding QueryTable as a ListObject returns ZERO occurrence because of Where Clause whereas the SQL is OK. If the Where Clause is removed, it
VBA SQL: Syntax Error in From Clause, Double Inner Join with Password
I’m reasonably new to SQL and I’m trying to create a string that collects the following: Code from [Catalogue Info] as c Description from [Product Information] as p Weight from p PPB from p CP-UK …
Cycling through Table Defs and Deleting
I have a subroutine that runs on a local copy of a database and a network stored master. To allow users to run my Excel add-in offline, I create a local version that has the same table names as the …
How to export Excel data from different sheets to SQL-SERVER Database?
I am new in Excel VBA and SQL. I have managed to create a macro button and push Excel cell data to SQL server tables. However, I am a bit puzzled: How can I take Excel cell data from different sheets and then push them to different tables in SQL Server database? (Currently, I have 3 sheets – Customers, Test,
Duplicate records in all related Access tables with new PK/FK assigned at button click event
I have an Access database with 5 tables: Report_Start holds PK on [Report_ID] CommSummary holds FK on [Report_ID] MRPCSummary holds FK on [Report_ID] SQESummary holds FK on [Report_ID] MEPSummary holds FK on [Report_ID] Report_ID links tables 2-4 to Table 1. User enters new report info on a user form (Report Date, Vendor, buyer, planner, etc), which is stored in Report_Start
Excel VBA – Stored Procedure (SQL Server)
I have a slight issue retrieving multiple recordsets (with column names) and pasting the data into an Excel sheet, like the image below The VBA code that I have just retrieves the first recordset but …
Creating data entry form using button VBA
I am trying to create a basic data entry form, however, it is turning into more trouble than I anticipated.. I have the form created, now I am just trying to INSERT the data into the DB (TEST). I am receiving an “Object Required” error. Any suggestions? All of the txt boxes are verified to be correct. This is all
Access VBA update a column to concatenate
I was trying to update a column from a table in my Access database with following VBA code but it did not work as nothing happpened to that column. I would like to concatenate 5 columns into one. This update statement would work in SQL server but obviously not here. Any advice? Thanks. Answer Perhaps some fields are Null? Try