Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2004
    Location
    Philippines
    Posts
    30

    Exclamation Unanswered: prevent requery on form open

    Hello everyone. It has been a while since I posted in dbforums. Hope all is fine and OK guys. Question please.

    I have a form purpose of which is to search by name. It has a subform to which a query is attached. The query has a field named "Name" to which this expression is placed in the criteria:

    Like "*" & [Forms]![frm_verification_check (name)]![name_x] & "*" And <>"Cancelled"

    [name_x] is the textbox on the form in which I input the name to search. My question is if it is possible to prevent the query of the subform from running whenever I open the form 'coz it takes some time for the form to load. I would rather the query run when I actually put the name in the textbox.

    Is there a way to prevent a form from requerying? Thanks a lot guys!
    pao_pao3

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    You could try something like:
    Code:
    Private Sub Form_Open(Cancel As Integer)
     
        Me.TheSubForm.SourceObject = ""
     
    End Sub
     
    Private Sub Command1_Click()
     
        Me.TheSubForm.SourceObject = "TheSubForm"
     
    End Sub
    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Jan 2004
    Location
    Philippines
    Posts
    30
    Thanks for the reply pootle flump! However, I never really used access' code builder on an advanced level, so I hope you can fill in the blanks for me.

    The name of the form is 'frm_search_name' and the name of the subform that shows the data is 'sf_search_name'. How do I actually insert the code? I was trying to fill in the blanks but it didn't work. I was trying to insert it as an event procedure in the On Open property of the subform.

    Thanks again!
    pao_pao3

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Nope - all on your main form. This should probably do it:

    Code:
    Private Sub Form_Open(Cancel As Integer) Me.sf_search_name.SourceObject = "" End Sub Private Sub Command1_Click() Me.sf_search_name.SourceObject = "sf_search_name" End Sub
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Jan 2004
    Location
    Philippines
    Posts
    30

    Exclamation can't make it work

    Hi PF, thanks again for the reply. I'm dumb, and can't really get it to work on my main form. I'll just give you all the details:

    Main Form: frm_search_name1

    Subform: sf_search_name2

    Control on main form to type search name in: name_x

    Will I put the code in the 'On Open' property of the main form? Thanks for time and patience PF!
    pao_pao3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •