Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2007
    Posts
    214

    Question Unanswered: Fairly simple access question (i think)!

    Hi,

    I have a form in my access databse that stores basic information such as "first name, last name, social security number and so on. The form is called "separations".

    I have another form in my access database called "claims" with similar fields. I basically want to be able to look up a record in my "separations" form, and if needed, plug in the first name, last name and social security fields from the "separations" form into my "claims" form instead of me having to enter the data manually. Right now i toggle between screens if I need to enter a info from "separations" to "claims" and I would just like to be able to click a button and just plug the information in automatically...if that make sense.

    I was thinking maybe this can be done by clicking a button? I'm just not sure what code to use etc. or really how to do this.

  2. #2
    Join Date
    Sep 2002
    Location
    South Wales
    Posts
    580
    Have a button on 'separations' which opens 'claims'.

    If you wish, you can also make 'separations' invisible at this stage (and reappear after 'claims' is closed.

    As long as 'separations' is open, you can refer to controls on in from 'claims';

    During the Form_Open event of 'claims' you can set your controls based on the values on the other form using this psudosyntax (I just made that word up for the record)...

    me.controlnameonclaimsform = Forms!namesparationsform.nameofcontrolonseparation sform
    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

  3. #3
    Join Date
    May 2009
    Posts
    5
    Hi All!

    Hi garethdart! Nice answer!

    Let me put the garethdart answer in more concrete terms.

    Lets suppose that the separations form is frmSeparations, and the claims form is frmClaims.

    frmSeparations controls include fldFirstName, fldLastName, fldSSN (textbox controls), and cmdSave, cmdClaims, and cmdCancel.

    Listing 1. frmSeparations code:
    Code:
    Private Sub cmdCancel_Click()
        DoCmd.Close acForm, Me.Name
    End Sub
    
    Private Sub cmdClaims_Click()
        'TODO: Don't forget to validate the form (and save the form).
        
        Me.Visible = False
        DoCmd.OpenForm "frmClaims"
    End Sub
    
    Private Sub cmdSave_Click()
        'TODO: Don't forget to validate the form when saving.
    End Sub
    When we click the cmdClaims command button the frmClaims form is opened. Additionally the frmSeparations form is made invisible.

    frmClaims controls include fldFirstName, fldLastName, fldSSN,fldOther, etc (textbox controls), and cmdSave, and cmdCancel.

    Listing 2. frmClaims code:
    Code:
    Private Sub cmdCancel_Click()
        DoCmd.Close acForm, Me.Name
    End Sub
    
    Private Sub cmdSave_Click()
        ' Whatever!!!
    End Sub
    
    Private Sub Form_Load()
        If CurrentProject.AllForms("frmSeparations").IsLoaded Then
            Me.fldFirstName = Forms!frmseparations!fldFirstName
            Me.fldLastName = Forms!frmseparations!fldLastName
            Me.fldSSN = Forms!frmseparations!fldSSN
            
            'Maybe it is wise to close the form after getting its data.
            DoCmd.Close acForm, "frmSeparations"
        End If
    End Sub
    When the frmClaims form is opened, it first checks if the frmSeparations form is loaded. If it is loaded it populates its fields with frmSeparations field values with the same name.

    I have uploaded an attachment with an access 2000 database that implements this.

    Cheers,
    Leonel Machava
    Attached Files Attached Files

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Wouldn't it be a better approach to have a table that stores PEOPLE and then both CLAIMS and SEPARATIONS only need to have the PeopleID in them, eliminating the need for all this?

    Seems like a normalisation fault to me.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  5. #5
    Join Date
    Sep 2002
    Location
    South Wales
    Posts
    580
    Pretty sure ST is right here - guessing there is a link between 'claims' and 'separations' anyway? If so and the Person is always the same in both, you need only store the value once. If you need to DISPLAY it on the other form, you could reference it through the query which forms the recordsource of the "claims" form?
    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

  6. #6
    Join Date
    Oct 2007
    Posts
    214
    Hi All,

    Let me clarify what I'm trying to do.

    I have to search "separations" to see if there is information there for a specific claim I'm working on. If the information is found in "separations" I then manually enter the SSN, FIRSTNAME, LASTNAME, and so fourth in the "claims" form. I would sooner be able to click a command button so that the info from "separations" is automatically placed into "claims" where appropriate instead of having to manually type it in.

  7. #7
    Join Date
    Sep 2002
    Location
    South Wales
    Posts
    580
    Are you able to post a .zip of your database please? No need for 'real' data.
    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

  8. #8
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

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