M
Michael
Sorry this is a bit long but I hope it is clear...
I have a parameter field PARAM on a parameter form into which I want to
enter a string validated as comprising three parts made up from different
fields in the database.
In "native" form on the parameter form it works well as follows:
1 - Double click on PARAM field and that makes a combo box visible and hides
the PARAM field.
2 - Select from combo and on tab (lost focus) make next combo visible....
etc.
3 - on completion of last combo and tab (lost focus) build the PARAM value
from the Me.cbo...values and makes all cbos visible=false and PARAM
visible=true.
It works exactly as I want it to !!
However, I want to use the same functionality in several places in the
database.
The tidiest way seemed to be to create a Function (I'm not into class
modules)
OnDoubleClick of PARAM
PARAM=PickImage
Function PickImage opens a small POPUP, MODAL form called frmPickImage with
three cbo boxes similar to those in the "native" version and uses the same
basic processing as the "native" form. This works fine within frmPickImage
itself but the problem is that the Function does not work because Access
does not seem to treat the small form as truly modal and only return program
control when the user has completed input - it seems to by asynchronous. The
code for the funciiton below illustrates what happens.
Public Function PickImage()
DoCmd.OpenForm ("frmPickImage") ' This opens the form fine
and triggers the OnOpen event of the form but when open processing completes
'
program flow IMMEDIATELY returns to the next line rather than waiting for
the user to complete data
'
entry and build the (Public) mcCurrentImagePath value from the three cbo
values.
PickImage = mcCurrentImagePath ' Therefore, since the
value has not been set the function returns null
'
The frustration is that the frmPickImage works fine and the
mcCurrentImagePath is built fine but sort-of arrives
' too late and the function has ended !!!!!!
End Function
It is driving me mad - any help please?
Michael.
I have a parameter field PARAM on a parameter form into which I want to
enter a string validated as comprising three parts made up from different
fields in the database.
In "native" form on the parameter form it works well as follows:
1 - Double click on PARAM field and that makes a combo box visible and hides
the PARAM field.
2 - Select from combo and on tab (lost focus) make next combo visible....
etc.
3 - on completion of last combo and tab (lost focus) build the PARAM value
from the Me.cbo...values and makes all cbos visible=false and PARAM
visible=true.
It works exactly as I want it to !!
However, I want to use the same functionality in several places in the
database.
The tidiest way seemed to be to create a Function (I'm not into class
modules)
OnDoubleClick of PARAM
PARAM=PickImage
Function PickImage opens a small POPUP, MODAL form called frmPickImage with
three cbo boxes similar to those in the "native" version and uses the same
basic processing as the "native" form. This works fine within frmPickImage
itself but the problem is that the Function does not work because Access
does not seem to treat the small form as truly modal and only return program
control when the user has completed input - it seems to by asynchronous. The
code for the funciiton below illustrates what happens.
Public Function PickImage()
DoCmd.OpenForm ("frmPickImage") ' This opens the form fine
and triggers the OnOpen event of the form but when open processing completes
'
program flow IMMEDIATELY returns to the next line rather than waiting for
the user to complete data
'
entry and build the (Public) mcCurrentImagePath value from the three cbo
values.
PickImage = mcCurrentImagePath ' Therefore, since the
value has not been set the function returns null
'
The frustration is that the frmPickImage works fine and the
mcCurrentImagePath is built fine but sort-of arrives
' too late and the function has ended !!!!!!
End Function
It is driving me mad - any help please?
Michael.