473,549 Members | 3,099 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to use public variables in a query field

6 New Member
I'm trying to define a field in a query using an expression. Part of that expression involves using public variables. First of all, is it possible to use variables in a query field? And if it is, what is the proper syntax for doing so?

Example: (This is in the query design. [Delivery Lead Time] is a current field in the query. EPEI and DC are the variables I want to use to calculate the LTR.)

LTR: [Delivery Lead Time]+"EPEI"+"DC"

(Access doesn't recognize EPEI and DC when I enter it in this way. I have defined EPEI and DC as public variables in VBA.)

Thanks in advance!
Sep 14 '10 #1
2 1980
patjones
931 Recognized Expert Contributor
I would probably do one of two things.

One possibility would be to just write the query out using SQL in VBA entirely, and then you'll have access to whatever you want.

The other possibility is that you can write a function in a global VBA module to perform the desired calculation. In query design view you'll find that you have access to that function.

Pat
Sep 14 '10 #2
JaketheSnake27
6 New Member
I'll have to try those and see how it goes. Thanks!
Sep 15 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1715
by: Jose Meireles | last post by:
Hi everyone, I'm trying to use public variables in a web form to hld specific values. What happens is that the public variables (declared as public x as y in the beginning of the class), doesn't seem to hold the value from function call to function call. Does anyone can help me abou this? best regards
3
3377
by: Parintas Themis STE Kardias | last post by:
Hi How can i use public variables. These variables i wand to use in different places on a form (like a button) and are neccessery to write the type of variable like: Public VAR1, var2 as integer or Public VAR1, var2 Thanks
11
2064
by: MLH | last post by:
I have a query field... Description: & "2-tone" When I run it, the output in that field is empty. If I change the name to MyDescription - it works fine. I noticed the query field has a Description property setting. That's what's causing my problem. Just a 'heads-up' to the group letting you know to watch out for it. It took me a long...
4
1598
by: Darrel | last post by:
I'm really stuck on the concept of using public variables to pass information between usercontrols. I'm pretty sure I'm just flubbing up the syntax. This is what I want: page usercontrol 1 - set variable usercontrol 2 - read variable
6
1893
by: darrel | last post by:
I'm still not quite sure how best to handle the passing of data between controls. This is a method I'm using at the moment: I have an XML file that contains a variety of page-centric variables. I have one control that loads the XML file, reads through it, and grabs the variables it needs. It then sets these to PUBLIC variables. Then,...
2
2359
by: vvenk | last post by:
Hello: I have defined public variables in Global.asax.vb that are initialized in the application_start event. How do I reference these variables in other ASP forms? For example, if my variable is goTest, I thought I can reference it as Global.goTest but I see that I cannot. Thanks.
4
2058
by: Webster | last post by:
Hello, Just wondering what's better programming style; to use public variables in a class or to use private/protected variables and then expose them via properties? For example: -------------------------------- Public Class public_person
7
2063
by: Steve Mauldin | last post by:
I have a public variable that is declared in a public module. This Variable is stored into a Session variable and used to pass data from page to page. I am seeing on my local development box that once the variable is created and loaded with data and stored into the session variable that on the next aspx page, before the first line of the page...
3
1631
by: PhilippeM | last post by:
Hi everyone! I have defined 3 public variables: Public OldCompany As Variant Public OldLast As Variant Public OldFirst As Variant A procedure defines those variables: OldCompany = !Company OldLast = !
2
2103
by: Dan Joosten | last post by:
I have an Access database on a Server which is accessed by several users via Remote Desktop. In the VBA code there are several values stored in Public Variables. I am wondering if each user who opens the database has it's own memory space on the server so that they do not overwrite the Public variables from another user? Does anyone know how...
0
7446
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7718
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7956
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7470
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7809
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5088
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1936
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1058
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.