473,379 Members | 1,386 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,379 software developers and data experts.

Form/SubForm PublicVar

48
Aren't Public Variables (not fields on the form) filled in an event of a Form not within the Visible scope of a SubForm ?

I have a Form Bound to a query, in the current-event of the Form the query-fields are copied into Public wrkFields (verified with MsgBox)

On the Form is a SubForm, in the events of the SubForm, the Public wrkFields (of above) aren't filled (verified with MsgBox)

Should I understand that Public variables aren't passed from Forms to SubForms ?
Nov 29 '07 #1
3 2493
ADezii
8,834 Expert 8TB
Aren't Public Variables (not fields on the form) filled in an event of a Form not within the Visible scope of a SubForm ?

I have a Form Bound to a query, in the current-event of the Form the query-fields are copied into Public wrkFields (verified with MsgBox)

On the Form is a SubForm, in the events of the SubForm, the Public wrkFields (of above) aren't filled (verified with MsgBox)

Should I understand that Public variables aren't passed from Forms to SubForms ?
Public Variables declared in a Standard Code Module are visible from 'anywhere' within the Application. If you are declaring a Variable as Public in a Form's Module, that is a different story
Nov 29 '07 #2
MikeTheBike
639 Expert 512MB
Public Variables declared in a Standard Code Module are visible from 'anywhere' within the Application. If you are declaring a Variable as Public in a Form's Module, that is a different story
Hi

If you declare a Public variable in a form (which is a Class object) then it is available outside the form (eg. a sub form), but only by referring to the Class/Object first ie.

MsgBox Form_MainFormName.PublicVariableName
(you have to include th 'Form_' to reference the class)

MTB
Nov 29 '07 #3
ADezii
8,834 Expert 8TB
Hi

If you declare a Public variable in a form (which is a Class object) then it is available outside the form (eg. a sub form), but only by referring to the Class/Object first ie.

MsgBox Form_MainFormName.PublicVariableName
(you have to include th 'Form_' to reference the class)

MTB
Hello MTB, as odd as it seems, Declaring a Variable as Public in a Form's Code Module essentially makes the Variable a 'Public' Property of the Class (in this case, the Form). As you have correctly stated, a fully qualified Path to the Variable Name is required for reference as in:
Expand|Select|Wrap|Line Numbers
  1. Forms!<Form Name>.PublicVariableName
Nov 30 '07 #4

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

Similar topics

9
by: William Wisnieski | last post by:
Hello Everyone, Access 2000 I have a main form with a continuous subform. On the main form I have a text field called . It gets populated based on what the user selects in a field on the...
25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
4
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the...
12
by: swingingming | last post by:
Hi, in the NorthWind sample database, when clicking on the next navigation button on the new order record with nothing on the subform (order details), we got an order with nothing ordered. How can...
9
by: PC Datasheet | last post by:
I'm stuck on something that seems should be easy and I need some help. My main form has an option group with five options. My subform chooses from different lists depending on which option is...
19
by: hamil | last post by:
I have a form with one button, Button1, and a Textbox, Textbox1 I have a class, class1 as follows. Public Class Class1 Public DeForm As Object Sub doit() DeForm.Textbox1.text = "It works"...
4
by: Macbane | last post by:
Hi, I have a 'main' form called frmIssues which has a subform control (named linkIssuesDrug) containing the subform sfrmLink_Issues_Drugs. A control button on the main form opens a pop-up form...
6
NeoPa
by: NeoPa | last post by:
Introduction The first thing to understand about Sub-Forms is that, to add a form onto another form takes a special Subform control. This Subform control acts as a container for the form that you...
11
by: mrowe | last post by:
I am using Access 2003. (I am also using ADO in the vast majority of my code. I recently read a post that indicated that ADO is not all that is was initially cracked up to be. In the back of my...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.