control reference change bet. 2002 & 2003?

F

Fredrated

I am trying to run an Access 2002 program under Access 2003, but a control
reference doesn't seem to work:
In a report query I reference a control in a date criteria as:
=[Forms]![fPaymentReport].[StartDate] And <[Forms]![fPaymentReport].[EndDate]+1
In Access 2002 it works with no problem.
In Access 2003 I get a prompt asking for Forms!fPaymentReport.StartDate

Is there a change from 2002 to 2003 in how to reference a control from
within a query? Or is there possibly some other problem caused by using my
2002 app in 2003?

Thanks in advance for any help.

Fred
 
R

ryguy7272

I don't have 2002; use 2007. I just tried it and it worked just fine for me.
Are you sure that's a one and not a lower-case L. Maybe delete the 1, and
add save, then open and add the 1 back in. Maybe you need to do a compact
and repair. Again, that concept worked fine for me...

Look at this for some ideas of how to do what you're trying to do:
http://mvps.org/access/forms/frm0031.htm


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


Fredrated said:
I am trying to run an Access 2002 program under Access 2003, but a control
reference doesn't seem to work:
In a report query I reference a control in a date criteria as:
=[Forms]![fPaymentReport].[StartDate] And <[Forms]![fPaymentReport].[EndDate]+1
In Access 2002 it works with no problem.
In Access 2003 I get a prompt asking for Forms!fPaymentReport.StartDate

Is there a change from 2002 to 2003 in how to reference a control from
within a query? Or is there possibly some other problem caused by using my
2002 app in 2003?

Thanks in advance for any help.

Fred
 
F

Fredrated

One thing I forgot to mention: the access 2002 app which runs successfully is
running in win xp, the 2003 version is running on a win 7 machine, and win 7
has caused other problems with access apps.

As for the response by ryguy7272, the 1 is indeed a one, but the suggestion
to compact/repair the database is a good one, I will do that as soon as I can
get to the machine (the interface is stored locally).

Fredrated said:
I am trying to run an Access 2002 program under Access 2003, but a control
reference doesn't seem to work:
In a report query I reference a control in a date criteria as:
=[Forms]![fPaymentReport].[StartDate] And <[Forms]![fPaymentReport].[EndDate]+1
In Access 2002 it works with no problem.
In Access 2003 I get a prompt asking for Forms!fPaymentReport.StartDate

Is there a change from 2002 to 2003 in how to reference a control from
within a query? Or is there possibly some other problem caused by using my
2002 app in 2003?

Thanks in advance for any help.

Fred
 
D

Dirk Goldgar

Fredrated said:
I am trying to run an Access 2002 program under Access 2003, but a control
reference doesn't seem to work:
In a report query I reference a control in a date criteria as:
=[Forms]![fPaymentReport].[StartDate] And
<[Forms]![fPaymentReport].[EndDate]+1
In Access 2002 it works with no problem.
In Access 2003 I get a prompt asking for Forms!fPaymentReport.StartDate

Is there a change from 2002 to 2003 in how to reference a control from
within a query? Or is there possibly some other problem caused by using
my
2002 app in 2003?

Thanks in advance for any help.


Does it make any difference if you change the dot (.) to a bang (!):

=[Forms]![fPaymentReport]![StartDate] And
<[Forms]![fPaymentReport]![EndDate]+1

That is more technically correct, though my Access 2003 seems to accept the
dot.
 
F

Fredrated

My mistake, the problem is slightly different from what I described.
The report query doesn't actually reference a control on the form, but
rather a custom form property which serves up the needed information. I
prefer this method of 'implementation hiding' as my preferred 'oop' style of
programming. This is what broke in the query. To fix this until I can find
out how to refer to a form property in a query, I have edited my query to
refer to the control instead of the property, and the application works again.

The property reference I described in the post, for example,
=[Forms]![fMain].[CurFrom] And <=[Forms]![fMain].[CurThru]
has worked until now, but now it seems Accss has changed how to refer to a
form property, so how to do so in Access 2003 is what I need to figure out.

Thanks for your reply and help!

Fred
Fredrated said:
I am trying to run an Access 2002 program under Access 2003, but a control
reference doesn't seem to work:
In a report query I reference a control in a date criteria as:
=[Forms]![fPaymentReport].[StartDate] And
<[Forms]![fPaymentReport].[EndDate]+1
In Access 2002 it works with no problem.
In Access 2003 I get a prompt asking for Forms!fPaymentReport.StartDate

Is there a change from 2002 to 2003 in how to reference a control from
within a query? Or is there possibly some other problem caused by using
my
2002 app in 2003?

Thanks in advance for any help.


Does it make any difference if you change the dot (.) to a bang (!):

=[Forms]![fPaymentReport]![StartDate] And
<[Forms]![fPaymentReport]![EndDate]+1

That is more technically correct, though my Access 2003 seems to accept the
dot.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)
 
D

Dirk Goldgar

Fredrated said:
My mistake, the problem is slightly different from what I described.

The report query doesn't actually reference a control on the form, but
rather a custom form property which serves up the needed information. I
prefer this method of 'implementation hiding' as my preferred 'oop' style
of
programming. This is what broke in the query. To fix this until I can
find
out how to refer to a form property in a query, I have edited my query to
refer to the control instead of the property, and the application works
again.

The property reference I described in the post, for example,
=[Forms]![fMain].[CurFrom] And <=[Forms]![fMain].[CurThru]
has worked until now, but now it seems Accss has changed how to refer to a
form property, so how to do so in Access 2003 is what I need to figure
out.

Thanks for your reply and help!

How did you implement your custom property? I just tried it with a property
implemented via this Public Property Get procedure:

Public Property Get curID() As Long

curID = Me.ID

End Property

I created a query with this SQL:

SELECT Table1.* FROM Table1
WHERE Table1.ID=[Forms]![Form2].[curID];

That query worked fine, and returned the record identified by the form's
curID property.
 
F

Fredrated

My code is exactly like yours, except that the word 'Public' was not in front
of the word 'property'. This has always worked in the past, but perhaps
Microsoft is being more strict.

So I put 'Public' in front of the properties. Oddly, it didn't work at
first, but after I closed the app and reopened it, voila! It works!

Thanks a lot for your help.

Fred

Dirk Goldgar said:
Fredrated said:
My mistake, the problem is slightly different from what I described.

The report query doesn't actually reference a control on the form, but
rather a custom form property which serves up the needed information. I
prefer this method of 'implementation hiding' as my preferred 'oop' style
of
programming. This is what broke in the query. To fix this until I can
find
out how to refer to a form property in a query, I have edited my query to
refer to the control instead of the property, and the application works
again.

The property reference I described in the post, for example,
=[Forms]![fMain].[CurFrom] And <=[Forms]![fMain].[CurThru]
has worked until now, but now it seems Accss has changed how to refer to a
form property, so how to do so in Access 2003 is what I need to figure
out.

Thanks for your reply and help!

How did you implement your custom property? I just tried it with a property
implemented via this Public Property Get procedure:

Public Property Get curID() As Long

curID = Me.ID

End Property

I created a query with this SQL:

SELECT Table1.* FROM Table1
WHERE Table1.ID=[Forms]![Form2].[curID];

That query worked fine, and returned the record identified by the form's
curID property.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)
 
D

Dirk Goldgar

Fredrated said:
My code is exactly like yours, except that the word 'Public' was not in
front
of the word 'property'. This has always worked in the past, but perhaps
Microsoft is being more strict.

Hmm, I don't think they are, at least not intentionally. I explicitly
specified Public, but according to the VB help file, "If not explicitly
specified using Public, Private, or Friend, Property procedures are public
by default." And I just tested a version of the procedure without
specifying Public (just "Property Get curID()"), and it worked fine in my
query.
So I put 'Public' in front of the properties. Oddly, it didn't work at
first, but after I closed the app and reopened it, voila! It works!

I have a feeling there may be something odd going on with your database --
possibly some corruption of your VB project. Just in case, I recommend
making a backup copy, then decompiling and recompiling the database.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top