+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 25

Thread: VBA Requery Problems

  1. #1
    Barn Regular nboscaino is an unknown quantity at this point nboscaino's Avatar
    Join Date
    Jul 2008
    Location
    Philadelphia, PA
    Posts
    94
    Rep Power
    3

    VBA Requery Problems

    Trying my hand at some VBA for the first time

    I am using the event lost focus to trigger a requery but I am getting some problems. The requery is unrelated to the form the event is in.

    The query is named [qry180expincdailynet]

    I thought to write:

    requery [qry180expincdailynet]

    Its not taking it. Anyone know what I am doing wrong?

  2. #2
    Barn Newbie RuralGuy is on a distinguished road RuralGuy's Avatar
    Join Date
    Mar 2008
    Posts
    31
    Rep Power
    3

    Maybe if you described why you feel you need to "requery" this query we can help.

  3. #3
    Barn Regular nboscaino is an unknown quantity at this point nboscaino's Avatar
    Join Date
    Jul 2008
    Location
    Philadelphia, PA
    Posts
    94
    Rep Power
    3

    I have a form that has a few subforms

    One subform is an entry form. The other form is a read out of averages and such. what is being entered is finanicial data debits, credits, dates etc. I have a few queries that give me a half year average. An example would be Aveerage deposits and average expenses and average net from both. Obviously these dynasets do not recalc upon new entry but I would like them to do so. I figured a good event would be lost focus. Dont know how I would go about that. Let me know if that is enough info

  4. #4
    Barn Newbie RuralGuy is on a distinguished road RuralGuy's Avatar
    Join Date
    Mar 2008
    Posts
    31
    Rep Power
    3

    Assuming the SubForms are bound to the "queries" then you want to requery the *SubForm* rather than the query directly.

  5. #5
    Barn Regular nboscaino is an unknown quantity at this point nboscaino's Avatar
    Join Date
    Jul 2008
    Location
    Philadelphia, PA
    Posts
    94
    Rep Power
    3

    cool Ill try that. Do you have any suggestions how I would write that. I am new to using VBA. Would you mind disclosing the statement I would use with an abitrary form name.

  6. #6
    Lightning Master AOG123 is a jewel in the rough AOG123 is a jewel in the rough AOG123 is a jewel in the rough AOG123 is a jewel in the rough AOG123's Avatar
    Join Date
    Mar 2008
    Location
    Fortress Of Solitude
    Posts
    221
    Rep Power
    6

    [Forms]![Parentformname].[Form]![subformname].Requery
    If i helped you, make me famous by clicking the

  7. #7
    Barn Newbie RuralGuy is on a distinguished road RuralGuy's Avatar
    Join Date
    Mar 2008
    Posts
    31
    Rep Power
    3

    Here's a good link for the syntax to use:
    Forms: Refer to Form and Subform properties and controls

  8. #8
    Barn Regular nboscaino is an unknown quantity at this point nboscaino's Avatar
    Join Date
    Jul 2008
    Location
    Philadelphia, PA
    Posts
    94
    Rep Power
    3

    I did what you wrote and it saying to me that MS access could not find the form 'qry180expincdailynet'. I wrote [forms]![master].[form]![qry180expincdailynet].requeryThanks for helping earlier. Mind shedding some light on why I am addressing the form instead of the query.

  9. #9
    Barn Newbie RuralGuy is on a distinguished road RuralGuy's Avatar
    Join Date
    Mar 2008
    Posts
    31
    Rep Power
    3

    Try: FORMS.YourFormName.YourSubFormName.FORM.Requery

  10. #10
    Barn Regular nboscaino is an unknown quantity at this point nboscaino's Avatar
    Join Date
    Jul 2008
    Location
    Philadelphia, PA
    Posts
    94
    Rep Power
    3

    Ok Ill try that thanks again

+ Reply to Thread
Page 1 of 3 1 2 3 LastLast

Bookmarks

Posting Permissions

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

SEO by vBSEO