Go Back   DeveloperBarn Forums > Databases > Microsoft Access

Sponsored Links

Discuss "VBA Requery Problems" in the Microsoft Access forum.

Microsoft Access - Microsoft Access is a database for small to medium applications. Learn tips and tricks and best database practices here.


Reply « Previous Thread | Next Thread »
 
LinkBack Thread Tools Display Modes
  #1  
Old August 22nd, 2008, 05:32 PM
Barn Regular

 
Join Date: Jul 2008
Location: Philadelphia, PA
Posts: 76
Thanks: 8
Thanked 0 Times in 0 Posts
Rep Power: 1
nboscaino is an unknown quantity at this point
Default 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?
Reply With Quote
Sponsored Links
  #2  
Old August 23rd, 2008, 07:15 PM
Barn Newbie

 
Join Date: Mar 2008
Posts: 15
Thanks: 0
Thanked 4 Times in 3 Posts
Rep Power: 1
RuralGuy is on a distinguished road
Default

Maybe if you described why you feel you need to "requery" this query we can help.
Reply With Quote
  #3  
Old August 25th, 2008, 01:05 PM
Barn Regular

 
Join Date: Jul 2008
Location: Philadelphia, PA
Posts: 76
Thanks: 8
Thanked 0 Times in 0 Posts
Rep Power: 1
nboscaino is an unknown quantity at this point
Default

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
Reply With Quote
  #4  
Old August 25th, 2008, 01:35 PM
Barn Newbie

 
Join Date: Mar 2008
Posts: 15
Thanks: 0
Thanked 4 Times in 3 Posts
Rep Power: 1
RuralGuy is on a distinguished road
Default

Assuming the SubForms are bound to the "queries" then you want to requery the *SubForm* rather than the query directly.
Reply With Quote
  #5  
Old August 25th, 2008, 02:41 PM
Barn Regular

 
Join Date: Jul 2008
Location: Philadelphia, PA
Posts: 76
Thanks: 8
Thanked 0 Times in 0 Posts
Rep Power: 1
nboscaino is an unknown quantity at this point
Default

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.
Reply With Quote
  #6  
Old August 25th, 2008, 03:00 PM
AOG123's Avatar
Lightning Master

 
Join Date: Mar 2008
Location: Fortress Of Solitude
Posts: 93
Thanks: 6
Thanked 23 Times in 18 Posts
Rep Power: 1
AOG123 is on a distinguished road

Awards Showcase
Microsoft Access 
Total Awards: 1

Default

[Forms]![Parentformname].[Form]![subformname].Requery
__________________
If i helped you, make me famous by clicking the
Reply With Quote
  #7  
Old August 25th, 2008, 05:50 PM
Barn Newbie

 
Join Date: Mar 2008
Posts: 15
Thanks: 0
Thanked 4 Times in 3 Posts
Rep Power: 1
RuralGuy is on a distinguished road
Default

Here's a good link for the syntax to use:
Forms: Refer to Form and Subform properties and controls
Reply With Quote
  #8  
Old August 25th, 2008, 08:24 PM
Barn Regular

 
Join Date: Jul 2008
Location: Philadelphia, PA
Posts: 76
Thanks: 8
Thanked 0 Times in 0 Posts
Rep Power: 1
nboscaino is an unknown quantity at this point
Default

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.
Reply With Quote
  #9  
Old August 25th, 2008, 10:09 PM
Barn Newbie

 
Join Date: Mar 2008
Posts: 15
Thanks: 0
Thanked 4 Times in 3 Posts
Rep Power: 1
RuralGuy is on a distinguished road
Default

Try: FORMS.YourFormName.YourSubFormName.FORM.Requery
Reply With Quote
  #10  
Old August 25th, 2008, 10:14 PM
Barn Regular

 
Join Date: Jul 2008
Location: Philadelphia, PA
Posts: 76
Thanks: 8
Thanked 0 Times in 0 Posts
Rep Power: 1
nboscaino is an unknown quantity at this point
Default

Ok Ill try that thanks again
Reply With Quote
Reply

  DeveloperBarn Forums > Databases > Microsoft Access

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT -4. The time now is 03:29 PM.



Content Relevant URLs by vBSEO 3.2.0