Results 1 to 13 of 13
  1. #1
    DCV0204 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    85

    Next Record Issue

    Ok, I can not figure out what is wrong with my code. When I try to go to the next record, I either get an error message or nothing happens. Would you mind taking a look at my code within my dbase to see why I can not get to the next record.


    Thanks.
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    Which form is involved? What steps do I take to replicate the issue?
    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
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    I can only find two 'next record' buttons; one has code to close a Form behind it:

    DoCmd.Close acForm, "Email_PrescriberReview", acSaveNo

    and the other has no code or macro at all!

  4. #4
    DCV0204 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    85
    Sorry, i had accidently removed the code I had for the next button.
    It is like the form needs to be refreshed or something before the next and previous buttons will work.
    I am attaching the dbase with the code. Click "Initial Review" button to open the "PrescriberReview" Form.
    The previous button is still based off the wizard macro.
    Thanks.
    Attached Files Attached Files

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    The Previous button is embedded macro with an error handler to deal with situation when the first record already has focus.

    The Next button is VBA code without any error handler.

    The form opens with 5 records but for some reason does not allow navigation, not even with the navigation bar.

    Do not understand relationship between Status and Non-Registered_Prescribers tables. Can each prescriber have more than one record in Status?

    There is code in the form current event that sets value of Send_ltr field. This puts the record in edit mode. Can't move from record until it is saved. I tried DoCmd.RunCommand acCmdSaveRecord but that triggers error 2115 - The macro or function set to the BeforeUpdate or Validation Rule ...

    So I commented out all the lines dealing with setting value of Send_ltr and the form allows navigation.
    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
    DCV0204 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    85
    Yes, 5 records is correct as these are records for testing an not the actual data.

    Yes, the providers status can change overtime so based on the date in the Status table I can determine the prescribers current status. I wanted to keep the previous status in tact. Therefore, Non-Registered_Prescribers to Status is a 1 to many relationship.

    Did you send the file back with your comments?
    Thanks,
    Lisa

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    No, just do the same thing I did. Comment out the relevant lines.

    Also, should not include the Status table in the form RecordSource. Once you get more than one Status record for each prescriber, the form will show multiple records for each prescriber.

    Then you should fix the VBA for the Next button.
    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.

  8. #8
    DCV0204 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    85
    I am not a vba expert and do no understand what you mean by comment out the relevant lines.
    Can you provide me an example?

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    You did not write the code in this db?

    Find every line like: Me.Send_Ltr =

    But not the lines that begin with If.

    Put an apostrophe in front. That makes it a comment and will not execute.
    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.

  10. #10
    DCV0204 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    85
    Yes, sorry I misunderstood what you were stating in your previous post.

    Ok, I must be doing something wrong because I can not get it to go to the next record.

    If I remove the status table from my query my code will not work.

    will you send me the copy of the database where you got it to work so I can compare and see what I am doing wrong?
    Thanks.

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    I prefer you follow the same steps and accomplish yourself. Here is what I did with your file. Modified the PrescriberReview form as follows:

    1. comment the Me.Send_Ltr = lines so they won't execute

    2. set PrescriberReview form RecordSource to Non-Registered_Prescribers table

    3. comment 2 more lines
    'Me.Status = "Blocked"
    'Me.StatusDate = Date

    4. open form from the MainMenu form button and navigate records
    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.

  12. #12
    DCV0204 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    85
    Thanks June7 I can now navigate to the next record, but since my form is linked to the table instead of my query how can I filter the form after each form (record) is updated where the ReviewedBy is null?
    Thanks.

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    Options:

    1. use intrinsic filter tools - right click on the ReviewedBy textbox to open the shortcut menu

    2. use code to set the form Filter and FilterOn properties

    3. if you want the form to open only to records where ReviewedBy is null, use a query with static filter criteria - but don't include the Status table
    or use the WHERE CONDITION argument of DoCmd.OpenForm
    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.

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

Similar Threads

  1. Replies: 9
    Last Post: 05-12-2012, 12:16 PM
  2. Per Record basis issue, NEED Help
    By PAS123 in forum Programming
    Replies: 2
    Last Post: 12-20-2011, 10:15 AM
  3. list box goto record issue
    By Madmax in forum Access
    Replies: 2
    Last Post: 07-07-2011, 06:17 AM
  4. Adding new Record issue
    By yosik20 in forum Forms
    Replies: 3
    Last Post: 04-13-2011, 10:19 AM
  5. Current Record Update Issue
    By SALPBE in forum Programming
    Replies: 0
    Last Post: 02-23-2011, 03:02 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