Results 1 to 5 of 5

Thread: Populate form

  1. #1
    Join Date
    Sep 2001

    Unanswered: Populate form

    I have a form (invoice) that when open prompts for an existing invoice
    number and populates the fields with data. The form has a button
    that when the button pressed, opens another form (clauses) and
    populates the fields with data based on the invoice number entered initially(File -clauses_code - uploaded). THIS WORKS FINE.

    Now the user wants to populate another form with existing data
    eliminating the need to re-type the info similar to the clauses form above. The user wants to click a button and based on the insurance type which is on the main form, open the appropriate form and populate the data based
    on the invoice number entered on the main form.

    For example:
    Invoice no. 15 is entered when the main form is opened and the data
    from invoice no. 15 is populated including the insurance type. When
    the user clicks a button, the user wants the appropriate details form
    to open with the data from invoice no. 15.

    How can I accomplish this by amending the existing code?

    Let me know if you need further clarification.
    Attached Files Attached Files

  2. #2
    Join Date
    Jun 2005
    Richmond, Virginia USA
    Provided Answers: 19
    One approach would be to

    1) Declare a global variable in a standard module for each item
    2) Open your new form and goto a new record
    3) Assign each global variable to the appropriate control in the new record
    Hope this helps!

    The problem with making anything that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Sep 2001
    Thanks MissingLinq.

    The only problem I have with that is that the forms being opened based on the instypecode have different fields e.g. if instypecode = 1 the fields maybe a,b,c; instypecode = 2 might have a,l,o,p etc.

    Is there a simplier solution.

  4. #4
    Join Date
    May 2004
    New York State
    I assume the table InsuranceTypes already exists. You can add a field, called maybe SubFormName, text, where you can manually type - once - the name of the subform to be opened when that type appears on the main form. Be sure to include the SubFormName variable in the main form's record source, as well as an INVISIBLE text box on the main form. When you then click on the command button to open the subform, use the contents of Me.SubFormName as the name of the form to open, as in:

    DoCmd.OpenForm Me.SubFormName .......


  5. #5
    Join Date
    Sep 2001
    thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts