DeveloperBarn Forums

DeveloperBarn

Programming & IT forum

VBA Requery Problems

This is a discussion on VBA Requery Problems within the Microsoft Access forums, part of the Databases category; Trying my hand at some VBA for the first time I am using the event lost focus to trigger a ...

Go Back   DeveloperBarn Forums > Databases > Microsoft Access

  #1  
Old August 22nd, 2008, 05:32 PM
Barn Regular
 
Join Date: Jul 2008
Location: Philadelphia, PA
Posts: 94
Rep Power: 2
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
  #2  
Old August 23rd, 2008, 07:15 PM
Barn Newbie
 
Join Date: Mar 2008
Posts: 31
Rep Power: 2
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: 94
Rep Power: 2
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: 31
Rep Power: 2
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: 94
Rep Power: 2
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: 218
Rep Power: 5
AOG123 is a jewel in the roughAOG123 is a jewel in the roughAOG123 is a jewel in the roughAOG123 is a jewel in the rough
Default

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

Status: Currently Unemployed - Looking for Work, Can be contacted on thethresher@hotmail.co.uk
Reply With Quote
  #7  
Old August 25th, 2008, 05:50 PM
Barn Newbie
 
Join Date: Mar 2008
Posts: 31
Rep Power: 2
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: 94
Rep Power: 2
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: 31
Rep Power: 2
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: 94
Rep Power: 2
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



All times are GMT -4. The time now is 10:22 PM.


Copyright ©2008-2010, DeveloperBarn

Content Relevant URLs by vBSEO 3.3.2