web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Unable to use Variable...
Power Automate
Unanswered

Unable to use Variables with SQL Statements inputting to Access

(1) ShareShare
ReportReport
Posted on by 18
Hello. I am attempting to place variables gotten from my flow onto an Access Database. Whilst doing this, I have been unable to actually add any. No iteration of signs around the variables gets them to work, and I have looked for a while. I may have just been overlooking something or mistyped, but I need help now. 
 
My current code for it is below, but as I have said- it does not work

INSERT INTO ImageBase (Forename)

VALUES

(%'FirstName'%)

Following advice I have found, I have put ' punctuation marks around the variable name, leading to the name of the variable being written into the table- rather than the actual variable insides. Using % signs around it returns a Syntax Error. Any help will be greatly appreciated.

I do have PowerFX enabled for my flow, and below is a screenshot of the actions I'm using to attempt this process. 
 
I have the same question (0)
  • Suggested answer
    Sam_Fawzi Profile Picture
    748 Super User 2025 Season 2 on at
    Unable to use Variables with SQL Statements inputting to Access
     
    Try using parameters. Do not put % or quotes around the variable name. In Access/ODBC the placeholder is ?.
     
    INSERT INTO ImageBase (Forename) VALUES (?);
    Parameters (in the action)
    Type: String
    Value: @{variables('FirstName')}  or the dynamic content from your flow
     
    The connector will pass the value and handle quoting. Putting 'FirstName' inserts the literal text FirstName. % is a LIKE wildcard, not a variable marker.
    If you must build the SQL string yourself (not recommended), escape quotes:
    INSERT INTO ImageBase (Forename) VALUES ('@{replace(variables('FirstName'), '''', '''''')}');
    Checks:
    • ImageBase.Forename is Text type.
    • No trailing semicolons or extra lines in the action.
    For multiple fields:
    INSERT INTO ImageBase (Forename, Surname) VALUES (?, ?);

    Add two parameters in order.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard