R
Rajesh B. Patel
Hi,
When I open a form in acNormal view and acDialog window mode I cannot
set the DefaultValue property for a text field in the form since the
code after the DoCmd.OpenForm does not execute until after I exit the form.
If I open the form in acFormDS view then this works just fine. Here are
the code snippets:
In acNormal view:
DoCmd.OpenForm "frm_Hospitalization_Labs", acNormal, , , , acDialog,
strSelect
With Forms![frm_Hospitalization_Labs]
![txtID].DefaultValue = HospitalizationID
End With
----------
In acFormDS view:
DoCmd.OpenForm "frm_Hospitalization_Labs", acFormDS, , , , acDialog,
strSelect
With Forms![frm_Hospitalization_Labs]
![txtID].DefaultValue = HospitalizationID
End With
----------
In both cases strSelect is a string representing a sql query that I
set the frm_Hospitalization_Labs.RecordSource to in the Form_Open event.
Also, I am doing all of this in a Button_Click event (not that it matters).
Any idea why this does not work in both cases? I want to present this
form in acNormal view. Could this be an access bug?
Thanks.
raj
When I open a form in acNormal view and acDialog window mode I cannot
set the DefaultValue property for a text field in the form since the
code after the DoCmd.OpenForm does not execute until after I exit the form.
If I open the form in acFormDS view then this works just fine. Here are
the code snippets:
In acNormal view:
DoCmd.OpenForm "frm_Hospitalization_Labs", acNormal, , , , acDialog,
strSelect
With Forms![frm_Hospitalization_Labs]
![txtID].DefaultValue = HospitalizationID
End With
----------
In acFormDS view:
DoCmd.OpenForm "frm_Hospitalization_Labs", acFormDS, , , , acDialog,
strSelect
With Forms![frm_Hospitalization_Labs]
![txtID].DefaultValue = HospitalizationID
End With
----------
In both cases strSelect is a string representing a sql query that I
set the frm_Hospitalization_Labs.RecordSource to in the Form_Open event.
Also, I am doing all of this in a Button_Click event (not that it matters).
Any idea why this does not work in both cases? I want to present this
form in acNormal view. Could this be an access bug?
Thanks.
raj