SQL statements variable on *.mdb

Software technical issues not related to any of the other categories

Moderators: Georges, milos, NiceLabel Support Team

Post Reply
MCblogiz
Newcomer
Posts: 5
Joined: Wed Jan 15, 2020 1:00 pm

SQL statements variable on *.mdb

Post by MCblogiz » Wed Jan 15, 2020 1:12 pm

Hi everyone,
few days trying to find correct SQL statement for *.mdb file query.
Found some samples: https://www.nicelabel.com/support/knowl ... statements but no success maybe in case of using access DB instead of MS SQL Server.

Code: Select all

SELECT :variable FROM Augalai1 WHERE IDindexBK = 1;
Any thoughts?

User avatar
Kyleodonnell
NiceLabel Support
NiceLabel Support
Posts: 612
Joined: Mon Aug 28, 2017 3:07 pm

Re: SQL statements variable on *.mdb

Post by Kyleodonnell » Wed Jan 15, 2020 2:04 pm

MCblogiz,

Are you trying do a variable query? or simply just a query, if you wanted do variable query you would need to follow the steps exactly as the article states and run it through VB or python or you would use powerforms and do an execute sql statement on a button or event

User avatar
Saso
NiceLabel
NiceLabel
Posts: 2984
Joined: Mon Sep 04, 2006 8:09 am
Contact:

Re: SQL statements variable on *.mdb

Post by Saso » Wed Jan 15, 2020 2:26 pm

The EXEC() statement used in the KB article is not supported for queries inside Microsoft Access. You need Microsoft SQL server.
Saso Fleiser
Senior Technical Product Specialist

MCblogiz
Newcomer
Posts: 5
Joined: Wed Jan 15, 2020 1:00 pm

Re: SQL statements variable on *.mdb

Post by MCblogiz » Wed Jan 15, 2020 2:56 pm

Saso wrote:
Wed Jan 15, 2020 2:26 pm
The EXEC() statement used in the KB article is not supported for queries inside Microsoft Access. You need Microsoft SQL server.
Is it any way to use variables on *.mdb (access db) files?

MCblogiz
Newcomer
Posts: 5
Joined: Wed Jan 15, 2020 1:00 pm

Re: SQL statements variable on *.mdb

Post by MCblogiz » Wed Feb 05, 2020 8:36 am

Question simple, but answer not :(
Image

pherms
Enthusiast
Posts: 19
Joined: Thu Oct 10, 2019 4:23 pm

Re: SQL statements variable on *.mdb

Post by pherms » Tue Jun 02, 2020 10:39 am

Hi Mcblogiz,

The query "Select * from rgaminu_grupe" should indeed give you some results.

Is your rgaminu_grupe an existing table in your Access database?
Does the query work in Access itself?

Another issue you may have is you are thrying to put the result of this query in a variable. However, the query in your screenshot will probably return more than one field (the SELECT * part returns all fields of the table) and Nicelabel will most likely not be able to store the result in the variable and return an error.

I have had success with this approach:
SELECT field1 AS field1,
field2 AS field2
FROM rgaminu_grupe
WHER articlenumber=:some_search_variable_in_your_form

Make sure the variables field1 and field2 exist as variable in Nicelabel. You can also check the "iterate for every record" in the "Show execution and error handling options"

Hope this helps.

Kind regards,
pherms

Post Reply