Welcome to SynapseDirect Sign in | Join | Help
in Search

SynapseDirect

Using Microsoft Access and Word Mail Merge with Synapse

Last post 03-14-2008, 9:44 AM by qilin. 52 replies.
Page 1 of 4 (53 items)   1 2 3 4 Next >
Sort Posts: Previous Next
  •  01-20-2007, 7:56 AM 2291

    Using Microsoft Access and Word Mail Merge with Synapse

    Microsoft Access database can be used as a frontend client connecting to Synapse-EMR Firebird server database.  Steps to do this:

    1. Install Firebird program and Firebird ODBC driver on the client PC the same way as you install your Synapse-EMR server.
    2. Configure "Sysem DSN" in "Control panel - Administrative tools - ODBC Data Source Administrator", the same way as you configure your server.  If MS Access in not on the server PC, the databae address need to changed accordingly,

       ip.address.goes.here:C:/path/to/remr.fdb
       or
       \\mule\d:\path\to\reme.fdb
       or
       \\ip.address.goes.here\d:\path\to\remr.fdb

    3. Create MS Access database, "get external data - link tables", select ODBC databases for files of type, select "remr" from your machine datasource.
    4. Create forms, queries and reports.

    One neat function you can use is to use MS Access and Word Mail Merge to generate customizable letters, etc.  Steps for consult letter generation:

    1. Create a query "qryConsult" in MS Access, add tables "USERS", "CONSULTS", "STAFF" and "GPS"
    2. Join field [USERS].[UID] to [CONSULTS].[PATIENT], [USERS].[REFERER] to [GPS].[GID], [CONSULTS].[AUTHOR] to [STAFF].[SID], select fields needed for the consult letter from each table.
    3. Create a MS Word template file, using "qryConsult" in your database file as your data source.  Choose the fields and format the letter.
    4. In MS Access database file, create a form "frmVisits" to list the consults, add a button, in property window of this button - Event tab - on click - select [event procedure], use the following VBA codes.  This assumes your database file is named "Synapse.mdb" and your Word file is named "LetTmp.doc" and both files are saved in C:\EMR folder.  You may change the names and paths as you wish.

    Dim objWord As Object
    Dim myDoc As Word.Document

       
        Set objWord = CreateObject("Word.Application")
        objWord.Visible = True
       
        Documents.Open FileName:="c:\EMR\LetTmp.doc"
        Set myDoc = Documents("C:\EMR\LetTmp.doc")
       
      With myDoc.MailMerge
            .OpenDataSource _
                Name:="c:\EMR\Synapse.mdb", _
                ReadOnly:=True, _
                LinkToSource:=True, _
                SQLStatement:="Select * from [qryConsult] where ([ConsultID]) = " & Forms![frmVisits]![CONSULTID]
            .Destination = wdSendToNewDocument
            .Execute Pause:=False

      End With

        myDoc.Close SaveChanges:=wdDoNotSaveChanges

    5. Test and have fun.

    Notes: MS Access 2002 has "Microsoft Rich Textbox control", which displays Firebird BLOB file correctly but I haven't found a control in 2003 and 2007 that can do this.  If you use MS Access 2002 and choose to use "Microsoft Rich Textbox control", you should lock the field and don't attempt to modify the data in BLOB field ("consult" field from "CONSULTS" table in this case) in MS Access, otherwise Access will add Rich Text codes and mess up your data.  I am using plain text box for preview "consult" field in 2003 and 2007 now, it will display plain text without paragraphs, but Mail Merge works fine.
    Update: See posts later in this thread for how to add "Microsoft Rich Textbox Control" in MS Access 2003 and 2007.

    To enable spell check for "consult" field in MS Word, you need to use {QUOTE {MERGEFIELD CONSULT} \* CharFormat }

    If I can have previledge for attachments here, I can add some screenshots.  The above is more for people with some experiences in MS Access and Word.   For beginners who don't understand the above, feel free to ask or go over some tutorials, there are tons of them out there.


    Contributing
  •  01-20-2007, 12:20 PM 2301 in reply to 2291

    Re: Using Microsoft Access and Word Mail Merge with Synapse

    I suspect that if you are using OpenOffice, you may be able to do something similar.  This applies to both Linux and Windows users.

    Check out these instructions from the Firebird site on how to connect OpenOffice to Firebird using the JDBC drivers. 

    If anyone gets this going .. please let us know.

     


    Graham Chiu
    Beta Downloads and Documentation Wiki
    Developer Forum
  •  01-20-2007, 2:26 PM 2306 in reply to 2301

    Re: Using Microsoft Access and Word Mail Merge with Synapse

    Just a quick reminder .. if you use ODBC to do reports etc, then the data is passing across the network in clear text ie. unencrypted.  So, I suggest you don't use this method for remote Access reports unless you use a VPN.  Opening port 3050 is also a risk for hackers to get to your database.

    Synapse client contacts Synapse EMR server thru an encrypted tunnel, and Synapse EMR server then communicates with the Firebird database using ODBC ie. an n-tier architecture.


    Graham Chiu
    Beta Downloads and Documentation Wiki
    Developer Forum
  •  01-21-2007, 11:55 AM 2314 in reply to 2306

    Re: Using Microsoft Access and Word Mail Merge with Synapse

    Link field [USERS].[UID] to [CONSULTS].[PATIENT]

    How do i do that ?

    Confused 

     




    Developer
  •  01-21-2007, 1:24 PM 2316 in reply to 2314

    Re: Using Microsoft Access and Word Mail Merge with Synapse

    Do you mean "JOIN" the fields ?  (not link)



    Developer
  •  01-21-2007, 1:26 PM 2317 in reply to 2316

    Re: Using Microsoft Access and Word Mail Merge with Synapse

    [USERS].[REFER] -- do you mean [USERS].[REFERER]  ? or [CONSULTS].[REFER] ?

     

     



    Developer
  •  01-21-2007, 1:28 PM 2319 in reply to 2317

    Re: Using Microsoft Access and Word Mail Merge with Synapse

    I am trying to JOIN the fields in this Relationship Design Section.



    Developer
  •  01-21-2007, 1:29 PM 2320 in reply to 2319

    Re: Using Microsoft Access and Word Mail Merge with Synapse

    I believe I have now allowed all Registered Members permission to attach files.

     



    Developer
  •  01-21-2007, 5:38 PM 2352 in reply to 2320

    Re: Using Microsoft Access and Word Mail Merge with Synapse

    Attachment: qryjoin.jpg

    Sorry Jason for the confusion.  I edited and changed "Link" to "Join", it should be [USERS].[REFERER].  I wrote that in a hurry.  You couldn't get any one of the files I sent you to work?

    Looks like you are doing it right.  You can just drag one field from one table and drop to the other field in the other table to join them.

    And, now I see you use attachment, I thought insert picture was the only option.  Will add some screenshots



    Contributing
  •  01-21-2007, 6:40 PM 2363 in reply to 2352

    Re: Using Microsoft Access and Word Mail Merge with Synapse

    well. If I just run your .mdb file ...

    And I search for a patient lastname ... i get this -- Private Sub LNamefilter_AfterUpdate()

    Dim strFilter As String
    If IsNull(Me.LNamefilter) Then
      Me.FilterOn = False
    Else
      strFilter = "SURNAME like ""*" & Me.LNamefilter & "*"""
      Me.Filter = strFilter
      Me.FilterOn = True
     
      Forms![frmPatients]![subfrmPtList].SetFocus
      Forms![frmPatients]![subfrmPtList].Form.Filter = strFilter
      Forms![frmPatients]![subfrmPtList].Form.FilterOn = True

    End If

    End Sub

     =-=-=-=-=-=-=-=-=-=-=-=-

    The yellow line gives me an error when I try to search via lastname.

     




    Developer
  •  01-21-2007, 6:41 PM 2364 in reply to 2363

    Re: Using Microsoft Access and Word Mail Merge with Synapse

    Well I did only two things, and it seemed to work.

    (1) opened your file.

    (2) clicked the word icon.

    and it generated a Word Consult from the corresponding Synapse Consult.

     




    Developer
  •  01-21-2007, 6:51 PM 2365 in reply to 2364

    Re: Using Microsoft Access and Word Mail Merge with Synapse

    If I keep generating different word documents, I eventually get this.

     




    Developer
  •  01-21-2007, 6:52 PM 2366 in reply to 2365

    Re: Using Microsoft Access and Word Mail Merge with Synapse

    Attachment: patient.list.view.jpg

    Once, I've been elsewhere in Access.  How can I get back to this Patient List ?

     




    Developer
  •  01-21-2007, 9:56 PM 2377 in reply to 2363

    Re: Using Microsoft Access and Word Mail Merge with Synapse

    Jason:

      strFilter = "SURNAME like ""*" & Me.LNamefilter & "*"""
      Me.Filter = strFilter
      Me.FilterOn = True
     
      Forms![frmPatients]![subfrmPtList].SetFocus
      Forms![frmPatients]![subfrmPtList].Form.Filter = strFilter
      Forms![frmPatients]![subfrmPtList].Form.FilterOn = True

    Change "SURNAME like....
    to:
    "USERS.SURNAME like

    Once, I've been elsewhere in Access.  How can I get back to this Patient List ?

    I can put a button on all other forms to go back to the list view


    Contributing
  •  01-21-2007, 10:11 PM 2378 in reply to 2377

    Re: Using Microsoft Access and Word Mail Merge with Synapse

    qilin:

    I can put a button on all other forms to go back to the list view

    Is there another way ? (Manually).

     



    Developer
Page 1 of 4 (53 items)   1 2 3 4 Next >
View as RSS news feed in XML
Try-out the Click to try-out Synapse EMR Express Edition Free Synapse EMR Express Edition Click to try-out Synapse EMR Express Edition · ©2006 SynapseDirect · Terms and Conditions · Privacy Policy · help us keep Synapse EMR Express free for all Doctors

managing your electronic medical records · Unique Visits Dell Computer