What do I know!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to use the same form to process 1) New Adds to the table, 2) Edits to
the table, and 3) handling Not In List adds. Processing is a little different
for each case. For the first, the form should be empty. For the second, I'd
like to MsgBox the user for the name and use FindRecord to get to the right
place for the desired change. For the third, I'd like to put the OpenArgs
into the Name field so the user doesn't have to re-enter it.

Problem for me is that none of the events - Open, Load, Activate -- seem to
be able to know what the incoming state is - Add or Edit, OpenArgs Null or
not. My question is, is there any way to know these things for a processing
routine??
 
To open the form to add a new record, use:
DoCmd.OpenForm "Form1", DataMode:=acFormAdd

To open a form and assign a value to a field, use this kind of thing:
DoCmd.OpenForm "Form1", DataMode:=acFormAdd
Forms!Form1![PetType] = "dog"

To discover if a form was opened in add mode, test its DataEntry property.

If you open the form in dialog mode, pass the value in OpenArgs.
Then in the Load event of the form, you can assign the value to the control.

To open a form to edit a particular record, use:
DoCmd.OpenForm "Form1", WhereCondition = "[MyID]=99"

To let the user find a record in a form, use an unbound control rather than
InputBox(). Details in:
Using a Combo Box to Find Records
at:
http://allenbrowne.com/ser-03.html
 
Back
Top