Results 1 to 6 of 6
  1. #1
    Rschoenb is offline Novice
    Windows Vista Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    9

    Querie using form unbound txtbox start/end date - update subform Help please :)

    Hi,

    I am going to try and explain what I have done so far and what I am trying to attempt. I am hoping it can't be that hard. :/ I am also hoping someone knows what how I can fix this and make it work I am sure this has to do with my using DoCmd.OpenQuery.

    Within my query called "ForCustomerSurvey" - the line is placed within criteria within a field

    Between [Forms]![QRYTest-CustomerLoyalty]![txtStartDate] And [Forms]![QRYTest-CustomerLoyalty]![txtEndDate]

    ------

    Within my form called QRYTest-CustomerLoyalty I have two unbound text boxes one named txtStartDate and txtEndDate.

    I have a CMD-OK button event OnClick set with the following

    ------

    Private Sub cmdOK_Click( )
    DoCmd.OpenQuery "ForCustomerSurvey", acViewNormal, acEdit
    End Sub

    -----

    This works but opens a new query window that's not what I want. I need the query to show up within my subform which is table view of the query. When I click on the command button the subform stays blank an the new query window opens.



    THANK YOU in advance!

  2. #2
    TheShabz is offline Court Jester
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2010
    Posts
    1,368
    if the subform is bound to the query, all you need to do is requery the subform Me.SubformName.Requery.

  3. #3
    Rschoenb is offline Novice
    Windows Vista Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    9
    That's it? place a cmd button and "on-click" place Me.SubformName.Requery? Don't I have to state for it to run a DoCmd if it is a command button? Or does it really only take

    Private Sub cmdOK_Click()
    Me.SubformName.Requery
    End Sub

    Thank you

  4. #4
    TheShabz is offline Court Jester
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2010
    Posts
    1,368
    assuming you're not doing any data entry, yea.

  5. #5
    Rschoenb is offline Novice
    Windows Vista Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    9
    THANK YOU! It works great! Final code:

    Private Sub CustLoyalRefresh_Click()
    On Error GoTo Err_CustLoyalRefresh_Click


    Me.ForCustomerSurveySubform.Form.Requery

    Exit_CustLoyalRefresh_Click:
    Exit Sub

    Err_CustLoyalRefresh_Click:
    MsgBox Err.Description
    Resume Exit_CustLoyalRefresh_Click

  6. #6
    TheShabz is offline Court Jester
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2010
    Posts
    1,368
    Glad you got it to work. And yea, I forgot to mention that if you're requerying a subform, you have to specify the .form property to requery. Me.Requery does everything. Me.SubformName.Form.Requery does the subform data. Go ahead and mark the thread as solved, please.

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

Similar Threads

  1. Replies: 3
    Last Post: 08-08-2010, 12:21 PM
  2. Replies: 1
    Last Post: 07-07-2010, 04:22 PM
  3. update querie
    By frcastro in forum Queries
    Replies: 1
    Last Post: 06-23-2010, 04:20 AM
  4. Replies: 0
    Last Post: 05-09-2010, 08:43 AM
  5. Update from txtbox Help!
    By jbh02 in forum Queries
    Replies: 1
    Last Post: 09-29-2009, 10: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