473,406 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Public variables: memorized values

Hi everyone!

I have defined 3 public variables:
Expand|Select|Wrap|Line Numbers
  1. Public OldCompany As Variant
  2. Public OldLast As Variant
  3. Public OldFirst As Variant
A procedure defines those variables:
Expand|Select|Wrap|Line Numbers
  1. OldCompany = !Company
  2. OldLast = ![Last Name]
  3. OldFirst = ![First Name]
Now I would like to retreive those values for the variables in another procedure, in another form:
Expand|Select|Wrap|Line Numbers
  1. With rs1
  2.       .Index = "PrimaryKey"
  3.       .Seek "=", OldCompany, OldLast, OldFirst
For some reason, VB tells me those variables are empty, although, they should have been defined by the other procedure.

Could someone help me please?
Thank you!

Philippe
Aug 13 '08 #1
3 1622
ADezii
8,834 Expert 8TB
  1. Are the Variables Declared in a Standard Code Module and not a Form or Report Module?
  2. Is the Procedure defining those Variables executed before an attempt is made to retrieve their values?
Aug 13 '08 #2
I had them defined in the standard code module, but I overlooked that I had also defined them as a dim variable in the code of my private procedure. That ofcourse is the reason why it didn't work. It all works perfectly fine now.

Thank you.

Philippe



  1. Are the Variables Declared in a Standard Code Module and not a Form or Report Module?
  2. Is the Procedure defining those Variables executed before an attempt is made to retrieve their values?
Aug 13 '08 #3
ADezii
8,834 Expert 8TB
I had them defined in the standard code module, but I overlooked that I had also defined them as a dim variable in the code of my private procedure. That ofcourse is the reason why it didn't work. It all works perfectly fine now.

Thank you.

Philippe
Gald you figured it out, PhilippeM. Procedural Level Variable Declarations will always override Public Declarations.
Aug 13 '08 #4

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

Similar topics

2
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...
10
by: Zap | last post by:
Widespread opinion is that public data members are evil, because if you have to change the way the data is stored in your class you have to break the code accessing it, etc. After reading this...
3
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...
21
by: Anthony England | last post by:
Everyone knows that global variables get re-set in an mdb when an un-handled error is encountered, but it seems that this also happens when the variable is defined as private at form-level. So...
8
by: Floris van Haaster | last post by:
Hi All! I have a question, i have a web application and I store some member information in a variable i declared in a module like: Public some_info_variable as string in module1.vb But...
2
by: Darrel | last post by:
I'm working on an app where the ASPX pages aren't precompiled with the class.vb files I'm. This is so people can add their own ASPX pages down the road to the app (the .aspx pages become...
5
by: Henry Jones | last post by:
I posted in dotnet.general but I think this is a better place to post a VB question. I created a module in VS 2005 - Visual Basic Windows Project. I declared two strings public Public...
0
by: Murat Fidan | last post by:
Hi i used Public Shared variables in my global.asax in vb.net 2003 and i wrote code in Application_Start to fill variables. i works but after some times ( 5 days ,2 days it is not same ) variables...
11
by: Web Search Store | last post by:
Hello, I set up a web page with 2 user controls. In classic asp, the first one did all the declarations, and the second one used the values, and could reset it. In ASP.Net so far I can't...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.