Re: oop Programing quesiton....



I'm not sure why Intellisense wouldn't acknowledge it. The only time I've
seen it fail to acknowledge something is when there's a syntax error
somewhere in your code. Can you compile the entire project properly?



Rob

"John 3:16" <bobmcc@xxxxxxxxxxxxxxxxxx> wrote in message
news:Otrkw$$iGHA.3588@xxxxxxxxxxxxxxxxxxxxxxx
Rob,
The objective I am trying to gain insight into is this.
Assume there is a class named Addrs
-one of the properties of Addrs is Addrs.A
-another property is Addrs.B
-one of it's method is Addrs.GetAddrName(s as string) as string

What I would like to learn how to do is this....

While working on a form.
dim Something as new Addrs
Addrs.a = SomeValue

THEN I want to open another form...
.. execute Addrs.GetAddrName to populate Addrs.B with a value
from this 2nd form,

ON 2nd Form...
dim s as string
s = someValue
Something.b = Something.GetAddrName(s)

The problem I am experiencing is that the intellisense does
not acknowledge the existence of Something as an instanstiated class.
I just want to be able to allow the class to be the equivelant of
a global variable for lack of a better explanation.

I hope this explanation is clear.
Please bear with me on this and ask for further clarification if needed.

Thanks in advance,
bob.

"Robert Morley" <rmorley@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:%23ySWXP$iGHA.1276@xxxxxxxxxxxxxxxxxxxxxxx
Actually, in Access 2000 and beyond (and maybe 95/97, I forget), you most
certainly CAN have more than one instance of a form. You have to forego
using DoCmd.OpenForm, however, and instantiate the form directly. The
code
below is vastly simplified, but would happily open two instances of the
same
form.

Dim f1 As New MyForm
Dim f2 As New MyForm

f1.Visible = True
f1.SomeValue = "Form1"
f2.Visible = True
f2.SomeValue = "Form2"


Or in a class-based situation, you would simply instantiate the one form
with

Dim f1 As New MyForm
'Or more properly...
'Dim f1 As MyForm
'Set f1 As New MyForm
'... do stuff
'Set f1 = Nothing

Each instance of the class would then have its own instance of the form,
f1 (which you can then echo out of the class as a property, or do
whatever you want to do with it).


Rob


"Vadim Rapp" <vrapp@xxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:OmiowC$iGHA.3816@xxxxxxxxxxxxxxxxxxxxxxx
Hello John:
You wrote on Thu, 8 Jun 2021 14:23:34 -0400:

J> Thanks for the reply Vadim
J> The Class property is declared as Public.
J> ..but when you instanstiate a new class object, then
J> open the next form, the class is out of scope, so it's properties
are
J> out of scope.

Sorry, don't quite understand. In Access, you can't have more than one
instance of the same form. So you refer as forms!form1.myproperty=1.

Vadim







.



Relevant Pages

  • RE: Send Form to Remote Database
    ... first I thought the problem might be that you did not dim myForm as a string, ... Dim MyPath As String ... DoCmd.CopyObject MyPathFile, MyQryFile, acQuery, MyQryFile ...
    (microsoft.public.access.modulesdaovba)
  • Re: oop Programing quesiton....
    ... It compiles fine. ... -one of it's method is Addrs.GetAddrName(s as string) as string ... dim Something as new Addrs ... Dim f1 As New MyForm ...
    (microsoft.public.access.adp.sqlserver)
  • Re: oop Programing quesiton....
    ... Assume there is a class named Addrs ... -one of it's method is Addrs.GetAddrName(s as string) as string ... dim Something as new Addrs ... Dim f1 As New MyForm ...
    (microsoft.public.access.adp.sqlserver)
  • Search pattern
    ... Dim strfile As String ... Dim bAddressFound As Boolean ... Dim strCurrentChar As String ...
    (comp.databases.ms-access)
  • Re: multiplatform (pocketPC & desktopPC) (Daniel !!)
    ... Friend Versione As String ... Public Sub GetMyConnectionPalmare() ... Dim errorMessages As String ... Private Function GetDS_Desktop(ByVal SQL As String) As DataSet ...
    (microsoft.public.dotnet.framework.compactframework)