Connecting Tech Pros Worldwide Help | Site Map

Access2K vs 2003

Lauren Quantrell
Guest
 
Posts: n/a
#1: Nov 13 '05
Is there a primer somewhere that can tell me code that works perfectly
well in Access2K that won't work in 2003?

I have been forced to migrate a large 2K app to 2003 and am finding a
lot of things that don't work.

For example:

.... .OnClick = "Forms!myFormName.MyFunctionName()" doesn't work in 2003.

Steve Jorgensen
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Access2K vs 2003


I've always just used OnClick = "MyFunctionName()" in that case. Have you
tried that?

I haven't noticed the problem you're having, but I have noticed that at some
point Access stopped respecting optional parameters in expressions like that.
All parameters must be supplied - optional or not.

This is extremely annoying since the whole point of optional parameters is
that you can add them without breaking old code that doesn't know about them.
Of course now, that's no longer true. Not only can you break previously
working code, but the compiler doesn't check the kind of expresions that are
now broken, so you don't know about the problem until the user complains.

On 5 Oct 2005 19:38:31 -0700, "Lauren Quantrell" <laurenquantrell@hotmail.com>
wrote:
[color=blue]
>Is there a primer somewhere that can tell me code that works perfectly
>well in Access2K that won't work in 2003?
>
>I have been forced to migrate a large 2K app to 2003 and am finding a
>lot of things that don't work.
>
>For example:
>
>... .OnClick = "Forms!myFormName.MyFunctionName()" doesn't work in 2003.[/color]

Lauren Quantrell
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Access2K vs 2003


Hmmm, seems like I have more to worry about witht he optional
parameters.

I have been using:
... .OnClick = "Forms!myFormName.MyFunctionName()"
when

calling MyFunctionName() from Form!myOtherFormName
(MyFunctionName() resides in the code behind Forms!myFormName)

Lauren Quantrell
Guest
 
Posts: n/a
#4: Nov 13 '05

re: Access2K vs 2003


Hmmm, seems like I have more to worry about witht he optional
parameters.

I have been using:
... .OnClick = "Forms!myFormName.MyFunctionName()"
when

calling MyFunctionName() from Form!myOtherFormName
(MyFunctionName() resides in the code behind Forms!myFormName)

Steve Jorgensen
Guest
 
Posts: n/a
#5: Nov 13 '05

re: Access2K vs 2003


On 6 Oct 2005 05:30:10 -0700, "Lauren Quantrell" <laurenquantrell@hotmail.com>
wrote:
[color=blue]
>Hmmm, seems like I have more to worry about witht he optional
>parameters.
>
>I have been using:
> ... .OnClick = "Forms!myFormName.MyFunctionName()"
>when
>
> calling MyFunctionName() from Form!myOtherFormName
> (MyFunctionName() resides in the code behind Forms!myFormName)[/color]

I never said that doesn't work. I was just saying that I know when the
function is behind the same form, and I don't qualify the name, that it always
has worked for me. Have you checked to see if that is or is not working in
your application? That might help narrow down the source of the problem.
David W. Fenton
Guest
 
Posts: n/a
#6: Nov 13 '05

re: Access2K vs 2003


"Lauren Quantrell" <laurenquantrell@hotmail.com> wrote in
news:1128566311.335401.109520@g44g2000cwa.googlegr oups.com:
[color=blue]
> Is there a primer somewhere that can tell me code that works
> perfectly well in Access2K that won't work in 2003?
>
> I have been forced to migrate a large 2K app to 2003 and am
> finding a lot of things that don't work.
>
> For example:
>
> ... .OnClick = "Forms!myFormName.MyFunctionName()" doesn't work in
> 2003.[/color]

Are you talking about in the VBA code, or in the properties sheet?

If it's the former, I don't see why you have quotes there, which
should never work.

If the latter, then my suggestion would be to write a local wrapper
function that calls the remote function and see if that fixes the
problem. It's a kludge, but if it gets your app running, it hsould
be OK.

FWIW, I've not had any issues at all with any working A2K apps
breaking in A2K3.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Chuck Grimsby
Guest
 
Posts: n/a
#7: Nov 13 '05

re: Access2K vs 2003


On Thu, 06 Oct 2005 14:39:09 -0500, "David W. Fenton"
<dXXXfenton@bway.net.invalid> wrote:[color=blue]
>"Lauren Quantrell" <laurenquantrell@hotmail.com> wrote in
>news:1128566311.335401.109520@g44g2000cwa.googleg roups.com:[color=green]
>> Is there a primer somewhere that can tell me code that works
>> perfectly well in Access2K that won't work in 2003?
>> I have been forced to migrate a large 2K app to 2003 and am
>> finding a lot of things that don't work.
>> For example:
>> ... .OnClick = "Forms!myFormName.MyFunctionName()" doesn't work in
>> 2003.[/color][/color]
[color=blue]
>Are you talking about in the VBA code, or in the properties sheet?
>If it's the former, I don't see why you have quotes there, which
>should never work.
>If the latter, then my suggestion would be to write a local wrapper
>function that calls the remote function and see if that fixes the
>problem. It's a kludge, but if it gets your app running, it hsould
>be OK.
>FWIW, I've not had any issues at all with any working A2K apps
>breaking in A2K3.[/color]

Actually, if it's code that's used in more then 1 form, it should be
moved to a module. That way you won't have to also be concerned if
the form is opened or not.


--
Drive C: Error. (A)bort (R)etry (S)mack The Darned Thing

Lauren Quantrell
Guest
 
Posts: n/a
#8: Nov 13 '05

re: Access2K vs 2003


I noticed a typo in my reply.

What this should have been:

I have been using:
... .OnClick = "=Forms!myFormName.MyFunctionName()"
when
calling MyFunctionName() from Form!myOtherFormName

MyFunctionName() resides in the code behind Forms!myFormName
and I am calling setting the OnClick event of the property sheet in
Forms!myOtherFormName in VBA code.

Lauren Quantrell
Guest
 
Posts: n/a
#9: Nov 13 '05

re: Access2K vs 2003


and the issue Steve mentioned about 2003 not respecting Optional
parameters in expressions like:
OnClick = SomeFunctionName(0)

Function SomeFunctionName (SomeParam as Long, _
Optional SomeOptionalParam as Long)
'do some crazy wild thing here.
End Function

David W. Fenton
Guest
 
Posts: n/a
#10: Nov 13 '05

re: Access2K vs 2003


Chuck Grimsby <c.grimsby@worldnet.att.net.invalid> wrote in
news:hl6bk1teej0qqsqiuvpduv4ksd0oskt7sg@4ax.com:
[color=blue]
> On Thu, 06 Oct 2005 14:39:09 -0500, "David W. Fenton"
><dXXXfenton@bway.net.invalid> wrote:[color=green]
>>"Lauren Quantrell" <laurenquantrell@hotmail.com> wrote in
>>news:1128566311.335401.109520@g44g2000cwa.google groups.com:[color=darkred]
>>> Is there a primer somewhere that can tell me code that works
>>> perfectly well in Access2K that won't work in 2003?
>>> I have been forced to migrate a large 2K app to 2003 and am
>>> finding a lot of things that don't work.
>>> For example:
>>> ... .OnClick = "Forms!myFormName.MyFunctionName()" doesn't work
>>> in 2003.[/color][/color]
>[color=green]
>>Are you talking about in the VBA code, or in the properties sheet?
>>If it's the former, I don't see why you have quotes there, which
>>should never work.
>>If the latter, then my suggestion would be to write a local
>>wrapper function that calls the remote function and see if that
>>fixes the problem. It's a kludge, but if it gets your app running,
>>it hsould be OK.
>>FWIW, I've not had any issues at all with any working A2K apps
>>breaking in A2K3.[/color]
>
> Actually, if it's code that's used in more then 1 form, it should
> be moved to a module. That way you won't have to also be
> concerned if the form is opened or not.[/color]

Well, that all depends on what it does, doesn't it?

I've had called OnClick events of command buttons from other forms
because the button does something to that particular form that needs
to be initiated from the *other* form. Putting the code in a public
module makes no sense if the code itself operates only on the form
that it is hosted in.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Chuck Grimsby
Guest
 
Posts: n/a
#11: Nov 13 '05

re: Access2K vs 2003


On Thu, 06 Oct 2005 20:16:27 -0500, "David W. Fenton"
<dXXXfenton@bway.net.invalid> wrote:
[color=blue]
>Chuck Grimsby <c.grimsby@worldnet.att.net.invalid> wrote in
>news:hl6bk1teej0qqsqiuvpduv4ksd0oskt7sg@4ax.com :[/color]
[color=blue][color=green]
>> Actually, if it's code that's used in more then 1 form, it should
>> be moved to a module. That way you won't have to also be
>> concerned if the form is opened or not.[/color][/color]
[color=blue]
>Well, that all depends on what it does, doesn't it?
>I've had called OnClick events of command buttons from other forms
>because the button does something to that particular form that needs
>to be initiated from the *other* form. Putting the code in a public
>module makes no sense if the code itself operates only on the form
>that it is hosted in.[/color]

I can't say as I've ever had that problem myself. If I write code
that's specific to a form, then it's for that form. If another form
needs code similar to the code in a form, I re-write the code to be
more generic and accepts whatever information is needed as a series of
parameters and default values before moving it to a module.


--
Drive C: Error. (A)bort (R)etry (S)mack The Darned Thing

Lauren Quantrell
Guest
 
Posts: n/a
#12: Nov 13 '05

re: Access2K vs 2003


You're saying that if I write the following it will fail in Access 2003
because of the optional parameter?:

(Property Sheet:)

OnClick = SomeFunctionName(0)

(Module:)

Function SomeFunctionName (SomeParam as Long, Optional
SomeOptionalParam as Long)
'do some crazy wild thing here.
End Function

David W. Fenton
Guest
 
Posts: n/a
#13: Nov 13 '05

re: Access2K vs 2003


Chuck Grimsby <c.grimsby@worldnet.att.net.invalid> wrote in
news:oqgck1p7ac876t9v9gb56mdvgsvun10bha@4ax.com:
[color=blue]
> On Thu, 06 Oct 2005 20:16:27 -0500, "David W. Fenton"
><dXXXfenton@bway.net.invalid> wrote:
>[color=green]
>>Chuck Grimsby <c.grimsby@worldnet.att.net.invalid> wrote in
>>news:hl6bk1teej0qqsqiuvpduv4ksd0oskt7sg@4ax.co m:[/color]
>[color=green][color=darkred]
>>> Actually, if it's code that's used in more then 1 form, it
>>> should be moved to a module. That way you won't have to also be
>>> concerned if the form is opened or not.[/color][/color]
>[color=green]
>>Well, that all depends on what it does, doesn't it?
>>I've had called OnClick events of command buttons from other forms
>>because the button does something to that particular form that
>>needs to be initiated from the *other* form. Putting the code in a
>>public module makes no sense if the code itself operates only on
>>the form that it is hosted in.[/color]
>
> I can't say as I've ever had that problem myself. If I write code
> that's specific to a form, then it's for that form. If another
> form needs code similar to the code in a form, I re-write the code
> to be more generic and accepts whatever information is needed as a
> series of parameters and default values before moving it to a
> module.[/color]

Well, the point is that you weren't *required* to do that, but chose
to do so.

I've done what Lauren has described as a quick-and-dirty way to get
something working, because it's calling code that I already know
works perfectly well. Re-engineering it to work from elsewhere can
introduce bugs, and just using the existing code in-place has no
such danger.

I've never actually encountered the problem Lauren describes, but I
can't say that I've ever converted one of the apps that does what
she's doing to A2K or higher.

I'm not surprised about this. There are a number of things that were
broken in A2K, especially regarding the connection between forms and
their recordsources and between forms and their modules.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Steve Jorgensen
Guest
 
Posts: n/a
#14: Nov 13 '05

re: Access2K vs 2003


On 7 Oct 2005 09:35:17 -0700, "Lauren Quantrell" <laurenquantrell@hotmail.com>
wrote:
[color=blue]
>You're saying that if I write the following it will fail in Access 2003
>because of the optional parameter?:
>
>(Property Sheet:)
>
>OnClick = SomeFunctionName(0)
>
>(Module:)
>
>Function SomeFunctionName (SomeParam as Long, Optional
>SomeOptionalParam as Long)
> 'do some crazy wild thing here.
>End Function[/color]

I'm saying I've experienced that problem. I'm not sure exactly when the
problem started occurring, though. It could have been a service pack or an
Access version. I did not identify the problem until it was reported to me
that some menu items were not working, and I could not se why they were
failing. The only thing I could do to make it work again was to pass all
parameters, and not omit optionals.
Closed Thread


Similar Microsoft Access / VBA bytes