Results 1 to 13 of 13
  1. #1
    AussieGal is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    56

    Requery a subform after updating another table that is linked?

    I have a form that users enter billing logs in. There is a button users can click to the right of their billing data that opens another form where they can enter details regarding the billing log. Beside this button is a check box that shows them if details for this particular billing log has been created.
    I can not for the life of me work out how to get the check box to update with a check after I enter Billing details without opening and closing the form again. I felt I have tried requery and refresh in all ways I have seen here, yet it is not working.

    The main form is frmDslEnter and the billing log is entered in a subform from here called tblSessions subform. The checkbox on this subform is called chkProgressEntered, and it's control source is =Not IsNull([DSLIDNumber]). I tried putting the refresh on the Close button on the Billing Details page, on the Got Focus of the subform and the main form and haven't had any luck. I seem to be missing something but can't understand what. Any help is really appreciated.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Do you want to save the checkbox value to table? The checkbox is not bound to field. The ControlSource is an expression. This will not save a value to table. ControlSource must be a field of form's RecordSource for data to automatically save to record. So why bother with the checkbox if the presence of DSLIDNumber indicates that detail data is entered?

    Exactly what needs to be refreshed - DSLIDNumber? This field is on tblSessions subform? How is this field populated? The checkbox should automatically recalculate when the DSLIDNumber is input.
    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
    AussieGal is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    56
    I changed this around a little to suit new requirements. To answer your question, I used the check box mainly because of screen room and staff to not need to see the ID numbers. The issue still seems to be the field is not updated all the time on the main form. I have Form A, which shows a subform in Conitinues Forms view. Each record has a small command button on it that opens Form B. Here when I close, if I press on the Completed button it now generates a date stamp on Form B and then closes to return to Form A. This date Field is also showing on form A as it runs from a query which includes it. Yet it doesn't always update with the date as it should, yet sometimes it does? I nomrally need to close and re-open Form A to see if the date appears.
    I believe I want the code to look something like this, but this is obviously wrong. This is the code on my form B complete button>
    Private Sub cmdNoteComplete_Click()
    Me.PNComplete = Now()
    DoCmd.Close
    Forms!frmDSLEdit.frmSubSSessions.Form.Refresh
    End Sub
    I cannot work out how to requery Form A before I return to it.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Form B is supposed to open filtered to the record selected in subform on Form A?

    Want to provide db for analysis? Follow instructions at bottom of my post.
    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.

  5. #5
    AussieGal is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    56
    Form B is a pop up that when data is entered it has a relationship to form A. Eg I have a field in form B that puts the primary key from form A (it populates by putting it as a default value) from the currently selected record in Form A where data is entered. The query form A uses links the data that is entered in Form B if it exsists, by joining the 2 primary fields together (if they exist on form b) there is a date complete field that exsists on Form B that Form A displays. If I open and close the form that the Subform A exists on the data refreshes and the complete date from form B is shown. Yet sometimes Form A shows the Complete date after it is entered on form B and sometimes not. I can't seem to find the rule it is following. I need it to requery whenever data is entered on form B so that Form A always shows completed dates from Form B if they exist. My database is split and has many tables. If i really need to send it I will, but hopefully this will clarify things.

  6. #6
    AussieGal is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    56
    At the moment my code on Form B when I click the Complete button is:
    Private Sub cmdNoteComplete_Click()
    Me.PNComplete = Now()
    DoCmd.Close
    End Sub

    I want it to requery From A so when they return to it it displays the date in the Complete Form that is on form A (which is a form with a subform on it that displays the information).

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Show code that calls Form B.
    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
    AussieGal is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    56
    This is just a Macro opening the form that has a where condition ="[DSLIDNumber]=" & [SessionID]. When the form opens I have a hidden box which is the DSLIDNumber, I have it set so the default value in it is =[Forms]![frmDSLEnter]![tblSessions subform].[Form]![SessionID]. So when someone actually enters data in this Form B it puts the ID number in this hidden box which is the link used to join to form A.

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    I use only VBA, no macros. I would open Form B in dialog mode. This will suspend code execution on Form A until Form B closes. Don't know if macro has acDialog available.

    DoCmd.OpenForm "Form B", , , "[DSLIDNumber]=" & [SessionID], , acDialog
    Me.Requery
    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
    AussieGal is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    56
    Oh you are wonderful. It works just perfectly. Thank you sooooooooooo Much!

  11. #11
    AussieGal is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    56
    I am wondering if I could add one last question to this post....How would I get the main form Form A to return to the same record I was working on? After the Requery it returns all the way back at the top of the continuous form. I would guess I would again refrence the sessionID, but how would I make it scroll to that or put the curser back in that so the users don't have to scroll down sometimes hundreds of records trying to find the record they just added notes to?

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Try:

    Dim intID As Integer
    intID = Me.SessionID
    DoCmd.OpenForm "Form B", , , "[DSLIDNumber]=" & Me.SessionID, , acDialog
    Me.Requery
    With Me.RecordsetClone
    .FindFirst "SessionID=" & intID
    Me.Bookmark = .Bookmark
    End With
    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.

  13. #13
    AussieGal is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    56
    You really are wonderful. it works perfectly. Thank you so much! It is really appreciated.

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

Similar Threads

  1. Replies: 3
    Last Post: 11-04-2012, 09:25 AM
  2. Replies: 3
    Last Post: 04-17-2012, 10:28 AM
  3. Excel Linked Table not Updating
    By BillH in forum Import/Export Data
    Replies: 1
    Last Post: 06-09-2011, 08:37 AM
  4. Refresh Requery Subform
    By eww in forum Programming
    Replies: 1
    Last Post: 04-05-2011, 09:19 AM
  5. Linked Table in SubForm
    By jamphan in forum Forms
    Replies: 1
    Last Post: 01-24-2011, 02:01 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