adding a form

  • Thread starter Thread starter Rpettis31
  • Start date Start date
R

Rpettis31

I have a form with a button the generates and action request off of the main
form. I would like to add a new form if one had not been created and be able
to edit the form if one has been created if needed. I am thinking that when
the new form is created the form id number is retained on the initial form.
Therefore I would look at that value when I would open the form in edit if a
value is present or add form mode based on a null value in the text box. I
would then run a query if there is a value in the text box. Does this make
sense or is there a better way to do this.

Thanks
 
Rpettis31 said:
I have a form with a button the generates and action request off of the main
form. I would like to add a new form if one had not been created and be able
to edit the form if one has been created if needed. I am thinking that when
the new form is created the form id number is retained on the initial form.
Therefore I would look at that value when I would open the form in edit if a
value is present or add form mode based on a null value in the text box. I
would then run a query if there is a value in the text box. Does this make
sense or is there a better way to do this.


Read VBA Help on the OpenForm method. Pay particular
attention to the WhereCondition and DataMode arguments.

For example, the code could be something like:

If IsNull(Me.[the text box]) Then
DoCmd.OpenForm "other form", _
DataMode:= acFormAdd
Else
DoCmd.OpenForm "other form", _
DataMode:= acFormEdit, _
WhereCondition:= "[ID field] = " & Me.[the text
box]
End If
 
Back
Top