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

Access2003 Form/Query

48
Hi,

I have a form, bound to a query.
None of the queryfields are on the form as the form is only there for navigation.

In an form.event (OnCurrent) I want to use (in VBA) the queryfields, but ..... how do I reference to the QueryFields ?

Thx
Nov 27 '07 #1
13 1790
Rabbit
12,516 Expert Mod 8TB
You reference a field by typing the field name.
Nov 27 '07 #2
MMcCarthy
14,534 Expert Mod 8TB
Hi,

I have a form, bound to a query.
None of the queryfields are on the form as the form is only there for navigation.

In an form.event (OnCurrent) I want to use (in VBA) the queryfields, but ..... how do I reference to the QueryFields ?

Thx
Put the query fields on the form but set them to invisible if you don't want the user to see them.
Nov 27 '07 #3
wquatan
48
Put the query fields on the form but set them to invisible if you don't want the user to see them.
That's what I wanted to avoid.
I thought I would have been possible to use sort of Me!captionname.fieldname referencing instead of Me!fieldname
Nov 28 '07 #4
MMcCarthy
14,534 Expert Mod 8TB
That's what I wanted to avoid.
I thought I would have been possible to use sort of Me!captionname.fieldname referencing instead of Me!fieldname
If you want to refer to values in fields in the query bound to the form then those fields have to be in controls on the form.
Nov 28 '07 #5
Rabbit
12,516 Expert Mod 8TB
If you want to refer to values in fields in the query bound to the form then those fields have to be in controls on the form.
That can't be right, I know I've been able to reference fields that have no corresponding control on my form but are in my control source.
Nov 28 '07 #6
wquatan
48
That can't be right, I know I've been able to reference fields that have no corresponding control on my form but are in my control source.
That's exactly what I want to do.
Can you remember how-to ?
Would be great to have a syntax-sample :-)

Thx
Nov 28 '07 #7
NeoPa
32,556 Expert Mod 16PB
That can't be right, I know I've been able to reference fields that have no corresponding control on my form but are in my control source.
That would certainly be interesting Rabbit. I too am of the opinion that you reference an item by Me.ControlName rather than Me.FieldName.
It wouldn't be the first time you've confounded us with some extra clever stuff, but I wait to be convinced on this one.
Nov 28 '07 #8
missinglinq
3,532 Expert 2GB
And the winner is......Br'er Rabbit! Yes, you certainly can reference a field in the underlying table/query that isn't bound to a control on the form! The syntax is simply

Me.FieldName
!

Welcome to TheScripts, wquatan!

Linq ;0)>
Nov 28 '07 #9
MMcCarthy
14,534 Expert Mod 8TB
And the winner is......Br'er Rabbit! Yes, you certainly can reference a field in the underlying table/query that isn't bound to a control on the form! The syntax is simply

Me.FieldName
!

Welcome to TheScripts, wquatan!

Linq ;0)>
Nice one Rabbit and Linq.

I have honestly never tried to do that so the issue never came up. That's what fascinates me about Access. How much we don't know :D
Nov 28 '07 #10
FishVal
2,653 Expert 2GB
Its quite an interesting thing.

Seems that Item property of Form.Controls collection is quite intelligent to return recordset field when no control has the name passed as argument.

Example.
[SomeForm] has a RecordSource but no control.

? Forms!SomeForm.Controls.Count
0

? Forms!SomeForm.Controls!SomeField
<FieldValue>

? TypeName(Forms!SomeForm.Controls!SomeField)
AccessField
that is hidden class in Access library

And even more interesting.
Access creates property SomeField in Form_SomeForm class quite intelligently.
If [SomeForm] has a control bound to [SomeField], then the property is declared to return the control object. Otherwise it is declared to return AccessField object. Anyone can easily check this in Object Browser.

Summary.
  • if a form bound to query/table doesn't have a control with the name same as of recordset field, then references like
    Me.SomeField
    and
    Me!SomeField
    will return AccessField object
  • if a form bound to query/table has a control with the name same as of recordset field, then references like
    Me.SomeField
    and
    Me!SomeField
    will return the control object
Nov 28 '07 #11
MMcCarthy
14,534 Expert Mod 8TB
It's interesting stuff. Typical of Access to do something really clever and forget to tell you about it. :)
Nov 28 '07 #12
MMcCarthy
14,534 Expert Mod 8TB
It's interesting stuff. Typical of Access to do something really clever and forget to tell you about it. :)
By the way, if anyone would like to do an article on this that would be even better.
Nov 28 '07 #13
NeoPa
32,556 Expert Mod 16PB
Sounds like I was simply wrong on this one then :(
Never mind. It's something I should have a play with and know for the future. Thanks for the responses people :)
Nov 29 '07 #14

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

Similar topics

0
by: dynfax | last post by:
When I use Access 97 with Terminal Services, and the terminal window is minimized, the popup form displays - and when i reset the focus to the terminal window the popup form displays. In...
9
by: 2D Rick | last post by:
With the help from members in the VB forum I've pieced together code that works in VB6 to create radial text similar to "text on a path" seen in graphics programs.(on a circle only) I use an...
13
by: usenet | last post by:
How and where can one find out about the basics of VB/Access2003 syntax? I am a died in the wool C/C++/Java Linux/Unix programmer and I am finding it difficult to understand the program format...
3
by: ouldm8 | last post by:
Hi everybody, How can i get SQL Source of my tables in ACCESS 2003?? Please help. Thanks
2
by: deependrapathak | last post by:
Hi All, I am currently facing a crutial problem in Access2003 in Windows XP on just 3 PCs, the Application throws some of the errors specified below : 1. Error Number : 3075 Function is not...
8
by: sumansengupta | last post by:
Is it possible to hide a form in ms-access2003 , but keeping the timer running with that form ?
4
by: sumansengupta | last post by:
I created an access in access2003 , its being used in multiuser environment ..based on a particular value the database is automatically closed and only i can change the value. Even after the...
2
by: logo3 | last post by:
hello, I'm trying to fill the table named "ALBARANES" which is based on a query. The query use table "structureOK". There are 3 additional values should be updated. AS Expr2 AS Expr3 AS...
3
by: Ramchandar | last post by:
Hi, I am creating reports using VBA code. I have the same query in a querydef residing both in Access97 and Access2003. The result of this querydef is then moved to a table in Access97 and...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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.