Variables not showing as expected in controls (Access Web App) (1 Viewer)

aubrey1983

Registered User.
Local time
Today, 19:02
Joined
May 5, 2015
Messages
27
Hi i have this weird problem.

The variables i set is not displaying correctly in Access Web Apps, instead it displays the variable name itself.

Please see attached.

-Thanks-
Aubrey
 

Attachments

  • variables.png
    variables.png
    14.6 KB · Views: 245
Last edited:

pbaldy

Wino Moderator
Staff member
Local time
Today, 04:02
Joined
Aug 30, 2003
Messages
36,125
Variable implies a VBA variable, which you wouldn't be able to refer to in a macro. Since it's a web app I assume it's not a VBA variable, so what is it exactly? If it's a TempVar, you'd need the full reference to it.
 

aubrey1983

Registered User.
Local time
Today, 19:02
Joined
May 5, 2015
Messages
27
its a local variable, here attached is a sample i am trying to replicate.

I don't understand what is wrong with mine.
 

Attachments

  • Sample.png
    Sample.png
    54.4 KB · Views: 239

aubrey1983

Registered User.
Local time
Today, 19:02
Joined
May 5, 2015
Messages
27
Here attached better example, this time in my On Start Macro.
Please see attached.
 

Attachments

  • WelcomeVariable.png
    WelcomeVariable.png
    13 KB · Views: 362

aubrey1983

Registered User.
Local time
Today, 19:02
Joined
May 5, 2015
Messages
27
Got it solved! just realized, the equal sign is needed, just like a formula in an excel. This is really tricky. so without the equal sign it will treat the whole thing as string.

Thanks!
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 04:02
Joined
Aug 30, 2003
Messages
36,125
Glad you got it sorted.
 

AccessJunkie

Senior Managing Editor
Local time
Today, 04:02
Joined
May 11, 2006
Messages
278
Hi,

I recognize that On Start macro sample as well as the sample app name you are looking at - RestaurantSampleChapter8. I hope you are enjoying my book and the sample files.

It looks like you already figured out why Access was displaying the literal values you typed into the Message argument. The equal sign is needed in the first position whenever you are going to tell Access you want to use the result of an expression in a macro argument such as a MessageBox. In your case since you are concatenating a couple of values, the equal sign is needed.

Good luck with your continued studies of Access web apps.

--------------------
Jeff Conrad - Access Junkie - MVP Alumnus
Senior Content Developer - Modern Assistance and Support Experience - Microsoft Corporation

Author - Microsoft Access 2013 Inside Out
Author - Microsoft Access 2010 Inside Out
Co-author - Microsoft Office Access 2007 Inside Out
Access 2007/2010/2013 Info: http://www.AccessJunkie.com

----------
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/en-us/legal/Copyright/Default.aspx
----------
 

aubrey1983

Registered User.
Local time
Today, 19:02
Joined
May 5, 2015
Messages
27
Wow, Thanks for this reply Jeff, i never thought you will reply.
Yeah, your book is really good, just a need a little help in finding stuff. anyway access web app is totally different than desktop, or at least 90% diff.

Are the variables that set in macros can be reused in other macros?

Thanks!
 

AccessJunkie

Senior Managing Editor
Local time
Today, 04:02
Joined
May 11, 2006
Messages
278
Hi Aubrey,

Thanks for the nice comments on my book.

For your macro variable question the answer depends on the context.

In Access 2013 web apps, if you define a variable in a UI macro at the view level using the SetVariable macro action, the value will live on for the entire time you are using the app in the browser. The variable can be carried/referenced by other views in the app just fine. You can use it for example in control sources and even in other UI macros. However, the variable will be lost if the user closes their browser tab/window of the app or if they do a hard page refresh (F5). So just bear that in mind.

For data macros, the standard SetLocalVar action can be used to define a variable. However, those variables only exist within the lifetime of the event or macro logic being executed. Once the data macro logic completes, the variable is gone.

For named data macros, you can define what are called Return Variables (SetReturnVar). A variable defined here can be referenced from the calling macro. So a named data macro could pass around a variable between other named data macros. Also a UI macro could call a named data macro to get some values, and those values could be bubbled up from the data layer to the UI layer using return variables. Once brought back to the UI macro, you assign those values to variables which could be used in other areas of the app at the UI layer.

I hope that helps answer your question.

--------------------
Jeff Conrad - Access Junkie - MVP Alumnus
Senior Content Developer - Modern Assistance and Support Experience - Microsoft Corporation

Author - Microsoft Access 2013 Inside Out
Author - Microsoft Access 2010 Inside Out
Co-author - Microsoft Office Access 2007 Inside Out
Access 2007/2010/2013 Info: http://www.AccessJunkie.com

----------
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/en-us/legal/Copyright/Default.aspx
----------
 

aubrey1983

Registered User.
Local time
Today, 19:02
Joined
May 5, 2015
Messages
27
Great! thanks, appreciate the details. it worked as you said.
 

aubrey1983

Registered User.
Local time
Today, 19:02
Joined
May 5, 2015
Messages
27
Thanks again.

How about the other way around, from the UI macro variable, then i want to pass the values going to the data macro layer. is it possible?
 

aubrey1983

Registered User.
Local time
Today, 19:02
Joined
May 5, 2015
Messages
27
Or lets just say, how do i default a value base from Username(UserEmailAddress)?
I want to do this during the On Insert Event from the table.

is this possible?
 

Users who are viewing this thread

Top Bottom