There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express php pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
Solved: VBA Access Problem with Requery


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
dfriend846's Avatar
Senior Member with 133 posts.
 
Join Date: Aug 2005
Location: Wheaton, IL
Experience: Intermediate
28-Aug-2005, 07:21 AM #1
Solved: VBA Access Problem with Requery
I think I have found the answer to this: the subforms were actually named "Childxx" in the main form. When I changed the names of the objects the requery command works.

I want to learn Access VBA and am using work tasks as learning projects. For one I have an Excel dataset used as the datasource for Access. The data spans a number of years and each month I must report the month's activities in a number of categories. Using Access I first constructed queries to show the results using the Month() function allowing me to enter (e.g.) 8 for August. I then made a form with multiple tabs using subforms each showing a separate query. Everything works. I then put an option group on the main form for the month and am passing the value to the query using
[Forms]![frm Review The Month's RTAs]![Frame118]
This works also as all queries work when I have the form open and a value for Frame118 chosen (allowed values 1-12 for the month of the year). The idea is that if I change the value in frame118 then the value sent to the queries should change and therefore the data. I can do this for the first subform on tab 1 with a requery command coming from frame118, on click but the commented requeries fail.

Private Sub Frame118_Click()
DoCmd.Requery ("sfrm qry1a NA RTAs In")
'DoCmd.Requery ("sfrm qry1b NA New Business RTAs In")
'DoCmd.Requery ("sfrm qry1c NA RTAs Out")
'DoCmd.Requery ("sfrm qry1d NA New Business RTAs Out")
'DoCmd.Requery ("sfrm qry1e NA RTAs Out Late")
'DoCmd.Requery ("sfrm qry1g NA Effective RTAs")

End Sub

I can't figure out why the first one works and the others do not. I am thinking it may have to do with the subforms being on tabs and perhaps not well enough specified in the requery command. Can anyone offer some suggestions?
Dennis

Last edited by dfriend846 : 28-Aug-2005 07:37 AM. Reason: Found Problem
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 6,342 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
30-Aug-2005, 07:35 AM #2
Is there a Main Form?
If there is you may need to include it in the subforms name, unless the sub form is open and "current" Access VBA may not be able to find it, do you get any error messages when they fail?
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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 Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 02:24 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.