Results 1 to 6 of 6
  1. #1
    mnsemple83 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jul 2011
    Posts
    40

    Synchronization between forms

    I am currently working on a database and I am having issues with form synchronization.

    The forms that I have created consist of a main form that displays "Patient" data (Last Name, First Name, MRN - unique identifier), and a subform that displays a specific kind of data related to that "Patient" (Discharges, Resources, Vitals, etc.). When I switch between forms, I want the information being displayed in the second form to be related to the same patient from the first form (the patient info. listed in the main form should not change).

    I have tried using Macros and Modules to accomplish this but I am totally confused at this point. Does anyone have suggestions?
    Last edited by mnsemple83; 07-15-2011 at 09:29 AM. Reason: To be more clearer about my problem.

  2. #2
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    First off, you need to use the WHERE clause to get to the other information UNLESS the other information is going to be entering a new record for that part of the info. And, in order to have the correct info to use, you would need to issue a save
    Code:
    Me.Dirty = False
    first before attempting to open the next form. So, I take it that you hav separate tables for each form? Is that correct?

  3. #3
    mnsemple83 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jul 2011
    Posts
    40
    Quote Originally Posted by boblarson View Post
    First off, you need to use the WHERE clause to get to the other information UNLESS the other information is going to be entering a new record for that part of the info. And, in order to have the correct info to use, you would need to issue a save
    Code:
    Me.Dirty = False
    first before attempting to open the next form. So, I take it that you hav separate tables for each form? Is that correct?
    In the WHERE clause of the macro I am currently working on, this is what I have written:

    Code:
    [Forms]![frmDischarges]![MRNTxtBx]=[Forms]![frmResources]![MRNTxtBx]
    When I try running the code in my form, I get a message box asking for a parameter value. I click OK, click on the button that opens the Discharges form, and it still doesn't display the correct patient information.

    Each form is based on a separate table and the information is displayed in a subform based within a form that displays the patients Last Name, First Name, and MRN. Those fields are derived from the Patient's table, which is related to all the other tables in the database (via MRN).

    Where would I place the Me.Dirty = False code?

    I am using MS Access 2007.

  4. #4
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Quote Originally Posted by mnsemple83 View Post
    In the WHERE clause of the macro I am currently working on, this is what I have written:

    Code:
    [Forms]![frmDischarges]![MRNTxtBx]=[Forms]![frmResources]![MRNTxtBx]
    When I try running the code in my form, I get a message box asking for a parameter value. I click OK, click on the button that opens the Discharges form, and it still doesn't display the correct patient information.
    The where clause doesn't compare form controls. It is the FIELD (or fields) on the form being opened that need to match up with the control on the form that is opening the other form. So something like:
    Code:
    [FieldNameToMatchOnNewForm] = [Forms]![frmResources]![MRNTxtBx]
    But this could be much better accomplished using VBA instead of macros since you can check to see if there are any matching records in the table before opening the other form and then if there is, open with the where clause and if not, open to a new record and insert the patient ID into the new record so it can be filled out and is associated with the patient.

    Where would I place the Me.Dirty = False code?
    It would go in the click event of the button to open the other form. But since you are using a macro to open the other form, that code is not available to it, so you can either issue the command using the Action: RunCommand and the Command of SAVE RECORD.

  5. #5
    mnsemple83 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jul 2011
    Posts
    40
    I tried the code you suggested and it worked, but know I have to be able to apply it to every instance of that button (not just when I am switching from one particular form).

    In addition, I want to be able to still switch from patient to patient in the second form and when I switch forms, the patient whose information isbeing displayed will be the same as the first form. Can this be accomplished in macros or would I have to use VBA?

  6. #6
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Quote Originally Posted by mnsemple83 View Post
    I want to be able to still switch from patient to patient in the second form and when I switch forms, the patient whose information isbeing displayed will be the same as the first form. Can this be accomplished in macros or would I have to use VBA?
    To be able to switch between patients on the other forms would require the method described here:

    http://www.baldyweb.com/Bookmark.htm

    instead of filtering using the where clause.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. VB code for replication synchronization?
    By Eviscerator in forum Programming
    Replies: 0
    Last Post: 08-12-2010, 08:57 AM
  2. subform synchronization
    By bkelly in forum Forms
    Replies: 2
    Last Post: 09-25-2009, 04:51 PM
  3. Data synchronization between two offices
    By Hcasty in forum Access
    Replies: 1
    Last Post: 08-13-2009, 08:07 AM
  4. Replication/ synchronization via Internet
    By khuram in forum Access
    Replies: 0
    Last Post: 07-29-2009, 04:33 AM
  5. Combobox synchronization in a subform
    By pe_z in forum Forms
    Replies: 0
    Last Post: 02-26-2006, 01:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums