Results 1 to 4 of 4
  1. #1
    TinaCa is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    87

    VBA Sub Form Move to Last Blank Field

    I have a subform showing invoices that need to be paid in descending order by date. (6/1/12, 5/1/12, 4/1/12, etc. I originally set it so the cursor left the main form and went to the Check No Field in the subform. Problem is it goes to the first row. I needed it to go the record 2 or 3 down that needs to be paid (FIFO). i.e. It's 6/1 and I have a payment for 4/1/12 to enter. I want the subform to go that empty check no field - so not last and not first. So......Go To Last CheckNo field that is empty.



    Any ideas?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,601
    Is the subform filtered to show only records where CheckNo is null? If so, try:

    DoCmd.GoToRecord , , acLast

    http://msdn.microsoft.com/en-us/libr...ffice.12).aspx

    I am not sure what event to put the code in.
    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
    TinaCa is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    87
    This isn't working. The docmd.GoToControl was working when there were recordes in the subform but now that there is no data I get an error message... "You Can't go to the specified record".

    Tina

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,601
    Okay, need some code to first check if there is data and only move if data exists. Something like:

    If Me.subformControlName.Form.RecordsetClone.RecordCo unt > 0 Then DoCmd.GoToRecord , , acLast

    In what event did you put the code?
    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. Querying All Data When Form Field Is Blank
    By jre1229 in forum Queries
    Replies: 25
    Last Post: 08-22-2012, 11:32 AM
  2. move to different field when duplicate
    By Fabdav in forum Queries
    Replies: 1
    Last Post: 10-16-2011, 04:19 PM
  3. Replies: 4
    Last Post: 05-11-2011, 03:06 AM
  4. Move to next field command...
    By mvolpone in forum Forms
    Replies: 1
    Last Post: 07-06-2010, 09:30 PM
  5. Adding field to form causes blank view.
    By emccalment in forum Access
    Replies: 1
    Last Post: 04-02-2010, 06:27 PM

Tags for this Thread

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