Results 1 to 6 of 6
  1. #1
    cardgage is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2011
    Posts
    50

    Access not passing data when opening form

    Good evening all,

    I am having issues passing data from one form to another using VB code. Specifically, for this database, I am trying to pass PatientID from frmInclusionExclusion to frmPatientData, but for some reason PatientID ends up Null once frmPatientData opens.



    Any help with this would be much appreciated...I have attached the database below. Thanks!

    DbHelp.zip

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Why doesn't frmInclusionExclusion show the patient number when it first opens from frmOpening?

    I tested the Next button code and the PatientID is passing but not opening frmPatientData, keeps executing the Else. What patient choice will execute the OpenForm code?

    Why are you mixing embedded macros and VBA code? I use only VBA. Refer to link at bottom of my post for guidelines on VBA debugging.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    cardgage is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2011
    Posts
    50
    Quote Originally Posted by June7 View Post
    Why doesn't frmInclusionExclusion show the patient number when it first opens from frmOpening?

    I tested the Next button code and the PatientID is passing but not opening frmPatientData, keeps executing the Else. What patient choice will execute the OpenForm code?

    Why are you mixing embedded macros and VBA code? I use only VBA. Refer to link at bottom of my post for guidelines on VBA debugging.
    Thanks for the response. To answer your question, when frmInclusionExclusion opens, a patient hasn't been selected yet; that form is intended to start the data entry for a new patient. However, I don't want to include any additional data (i.e., waste time looking through records) until I know whether that patient will be included/excluded. FYI - the data already in the tables is dummy information that I entered while testing the database...not to scare anyone!

    When the Next button is clicked on frmInclusionExclusion, it should pass the PatientID that was created after data entry started on frmInclusionExclusion to frmPatientData.

    I mix embedded macros and VBA code because I'm not too comfortable coding in Access. I let Access code what it's capable of, and add whatever I can to add functionality from things that I've picked up...probably bad habit.

    Thanks again for the response.

  4. #4
    cardgage is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2011
    Posts
    50
    Sorry for the double-post...

    I seem to have figured out how to get PatientID to pass to frmPatientData by using the combo box on frmOpening to select the included patient (cmbPatientSelect will only display included patients) and clicking the Enter Data button. However, once frmPatientData opens with PatientID successfully passed, I cannot edit any of the fields. Anyone able to help?

    I have attached an updated version of the database with my fix.
    Attached Files Attached Files

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    I had assumed that selecting patient on frmOpening was necessary but that should not have direct bearing on the PatientID passed by frmInclusionExclusion to frmPatientData other than it limits frmInclusionExclusion recordset to the one PatientID.

    I still don't fully understand the behavior of these forms - how they should interact with each other.

    Problem with frmPatientData is the RecordSource is not an updatable query. Why have tblPatientInfo join to qryIncludedPatients which is just a query of tblPatientInfo? Remove the query from the RecordSource and pull birthdate from the table and fix the DOB textbox ControlSource.
    RecordSource can be simply: tblPatientInfo

    Why the message box before form opens?

    Why is DOB textbox formatted for Yes/No?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    cardgage is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2011
    Posts
    50
    Thanks June7, removing the query from the RecordSource for frmPatientData worked like a charm. That message box was part of my (primitive) debugging to see when PatientID was lost when I was having issues.

    Thanks again for your help...much appreciated!

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

Similar Threads

  1. Opening form with passing argument
    By eacollie in forum Forms
    Replies: 3
    Last Post: 06-03-2011, 09:37 AM
  2. Passing Data from on Form to Another..
    By ETCallHome in forum Forms
    Replies: 2
    Last Post: 03-12-2011, 12:26 AM
  3. Replies: 5
    Last Post: 03-11-2011, 10:29 PM
  4. Form not passing data to query
    By bobfin in forum Queries
    Replies: 13
    Last Post: 08-11-2010, 05:28 AM
  5. Passing Parameters to a Data Access Page
    By stevie6410 in forum Access
    Replies: 0
    Last Post: 10-01-2009, 09:14 AM

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