G
Guest
Situation: Form in datasheet view; Columns are F1 and F2
f2 is ComboBox with Record Source Type set to "fnBuildList"
fnBuildlist will supply options to the F2 combobox,
The list supplied will depend upon the value in F1
fnBuildList is properly constructed for its purpose (proper Parameters,
select structure, etc.) and runs well except for the problem described below:
(assume user has activated the F2 pulldown in record #6, which calls
fnBuildList)
fnBuildList contains the following code:
Dim f As Form : Set f = CodeContextObject 'establish reference to working
form
Debug.Print f.Name, f.CurrentRecord '>>> this works as expected
debug.print f!f1 '>>> This prints value of F1 in record #1, not what
we want
--------------------------------------------------------------
I want to be able to access the value of field F1 in the current record.
Why does Access make this so diffficult?
Note: "ME!f1" and "ME.f1.value" will not compile in this function. They
generate error: "Invalid use of keyword 'me'" , so don't suggest that unless
you can tell me why it won't compile.
I've also tried using the screen object, with no breakthrough.
My question, restated:
In a Record Source Function, which is designed to deliver a list of options
to
a ComboBox on a DataSheet form - a list that will be customized depending
upon
the value in another field in the same record on the form - How does one
construct a reference to the independent field/control value???
Putting it another way: How do I access the value of F1 in record 6?
Even if I setfocus to f1 in record 6 (which I can do in the function) a
reference to f!f1 still returns the vlaue of F1 in record #1. This makes me
think that there must be a separate cursor for pointing into the table that
does not synch with the apparent cursor in the screen.
If it is not possible, then what event is triggered when the user points or
arrows to any field in record 6? I can't find such an event.
Leonard
f2 is ComboBox with Record Source Type set to "fnBuildList"
fnBuildlist will supply options to the F2 combobox,
The list supplied will depend upon the value in F1
fnBuildList is properly constructed for its purpose (proper Parameters,
select structure, etc.) and runs well except for the problem described below:
(assume user has activated the F2 pulldown in record #6, which calls
fnBuildList)
fnBuildList contains the following code:
Dim f As Form : Set f = CodeContextObject 'establish reference to working
form
Debug.Print f.Name, f.CurrentRecord '>>> this works as expected
debug.print f!f1 '>>> This prints value of F1 in record #1, not what
we want
--------------------------------------------------------------
I want to be able to access the value of field F1 in the current record.
Why does Access make this so diffficult?
Note: "ME!f1" and "ME.f1.value" will not compile in this function. They
generate error: "Invalid use of keyword 'me'" , so don't suggest that unless
you can tell me why it won't compile.
I've also tried using the screen object, with no breakthrough.
My question, restated:
In a Record Source Function, which is designed to deliver a list of options
to
a ComboBox on a DataSheet form - a list that will be customized depending
upon
the value in another field in the same record on the form - How does one
construct a reference to the independent field/control value???
Putting it another way: How do I access the value of F1 in record 6?
Even if I setfocus to f1 in record 6 (which I can do in the function) a
reference to f!f1 still returns the vlaue of F1 in record #1. This makes me
think that there must be a separate cursor for pointing into the table that
does not synch with the apparent cursor in the screen.
If it is not possible, then what event is triggered when the user points or
arrows to any field in record 6? I can't find such an event.
Leonard