Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2009
    Posts
    17

    Unanswered: Auto-populate some fields in form

    Hi,

    I was wondering if anyone could help me. I have two tables, 'Meeting Minutes' and 'Actions Log', and both of these have forms based on them, called 'Form View Meeting Minutes’ and 'Form View Actions Log'. Meeting Minutes has a date field and several memo fields for each section of the meeting - e.g. the first is called 'Introduction'. Next to each section I have a button 'Action'; when people click on this it opens up 'Form View Actions Log' to a blank record so people can add an action. This form has many fields but only two I'm interested in now - 'Action date' and 'Meeting section'

    Now for the tricky part - when this form opens I want these two fields to be auto-populated, firstly, with the date that was entered into the Meeting Minutes form, and second, the section that the Action button was next to. i.e. When someone clicks on the Action button next to 'Introducion', I'd like the Actions log field 'Meeting section' to be 'Introduction' (I currently have this field set up to be a combo box with all the possible options). Presumably I would need some code in the on click event of the Action button, to fill in the appropriate fields.

    I hope I’ve explained this clearly enough!

    Thanks very much,

    Rachel

  2. #2
    Join Date
    Apr 2004
    Location
    Kingsland, Georgia
    Posts
    231
    you have some options here. On the user clicking the Action button, you could:
    1) run some code to INSERT a new record into your table, get the PK of that record, and then open the second form to that new record
    2) store the information in global variables in a code module, and in the Form_Load event assign those values to the textboxes
    3) pass in the values as a parameter string (seperated by a comma) to the form, and in the second form's Load event, Split the Me.arguments to get your values, then load them in the textboxes.

  3. #3
    Join Date
    Sep 2002
    Location
    South Wales
    Posts
    580
    Think it could be a lot easier than that...I would maybe suggest;

    During the on_click event of the actions button;

    Use openargs to open the 'Form View Actions Log' form with a parameter which refers to the section the button was clicked from.

    During the Form_Open event you can reference this value and set the form control accordingly.

    Also during the Form_Open event, (Assuming 'Meeting Minuites' is still open?) just refrerence Forms!MeetingMinuitesFormname.MeetingMinuitesDateC ontrol

    ......

    Psudocode;

    Form_Open 'This is the form open event for 'Form View Actions Log'

    SELECT CASE me.Openargs

    CASE 'Section One'
    me.sectioncontrolvalue = 'Section One' 'Or primary key if a combo etc.

    CASE 'Section Two etc'
    me.sectioncontrolvalue = 'Section Two' 'Or primary key if a combo etc.

    CASE ELSE
    'Not valid?

    END SELECT

    me.datecontrol = Forms!MeetingMinuitesFormname.MeetingMinuitesDateC ontrol
    Windows Server 2003-8 / Terminal Services / SQL 2000 / Access 2003 / Office 2003-7 / Exchange 2003-7 / Blackberry Enterprise Server / AutoCAD / Lambert And Butler / Red Bull

Posting Permissions

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