473,945 Members | 25,823 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem Getting Requery to work

3 New Member
I've been searching around for a bit and can't find a solution to this problem. I've got a subform that show a list of requests that need to be processed in datasheet view. One of the fields on the subform is a status which is a combo box with three choices (pending, withdrawn, processed). The subform shows the requests that have pending in the status field. When someone changes that status to something besides pending I'd like that record to automatically be deleted from view. Only way I've found thus far to this is by closing/reopening the whole form or using shift+F9.

I did find a few references on the web for the .requery or .refresh commands, but I can't figure out how to use them. Seems each place also has different syntax to make those work. Also I'm not sure if I'm adding the code in the right spot. When I add the code to the form properties under the afterUpdate event I get an error saying "can't find a macro with specified name".... and the macro it can't find is the name of the form.

"Main Form"![status].Requery

That's what I've been trying to work with, not sure if I've got the syntax wrong or putting it in the wrong spot.

Thanks for any help.
Jan 9 '07 #1
8 3055
NeoPa
32,584 Recognized Expert Moderator MVP
This should help you (How can I refresh a sub form).
Jan 9 '07 #2
Jarekb
3 New Member
This should help you (How can I refresh a sub form).
Thats a bit confusing since it looks like the whole code of the form. I'm just using the design view to create this form.

I tried creating a macro that just has Requery under Action and nothing in the control name field. In the sub form's properties under the events tab, I set this macro to the afterUpdate field. This works when I open the subform separately, I change the status to processed and after clicking elsewhere the record disappears from the list. When I go to my main form I get this error when trying to change a record though "You can't use the ApplyFilter action on this window". So I kinda got this to work, but not in my main form. Would any problems be caused by the fact that this whole section is in a tab?
Jan 9 '07 #3
NeoPa
32,584 Recognized Expert Moderator MVP
I don't think that the SubForm control being on a tab makes any difference in this case.
Other than that I'm afraid I can't follow what you're saying at all :(
Jan 9 '07 #4
MMcCarthy
14,534 Recognized Expert Moderator MVP
I've been searching around for a bit and can't find a solution to this problem. I've got a subform that show a list of requests that need to be processed in datasheet view. One of the fields on the subform is a status which is a combo box with three choices (pending, withdrawn, processed). The subform shows the requests that have pending in the status field. When someone changes that status to something besides pending I'd like that record to automatically be deleted from view. Only way I've found thus far to this is by closing/reopening the whole form or using shift+F9.

I did find a few references on the web for the .requery or .refresh commands, but I can't figure out how to use them. Seems each place also has different syntax to make those work. Also I'm not sure if I'm adding the code in the right spot. When I add the code to the form properties under the afterUpdate event I get an error saying "can't find a macro with specified name".... and the macro it can't find is the name of the form.

"Main Form"![status].Requery

That's what I've been trying to work with, not sure if I've got the syntax wrong or putting it in the wrong spot.

Thanks for any help.
Assuming your query behind the subfom only returns records where status is Pending then a requery of the subform will change the records shown and remove any records that have had their status changed.

Therefore in the After Update Event of the status control box on the subform you would need something like the following VBA code

Expand|Select|Wrap|Line Numbers
  1. Private Sub Status_AfterUpdate()
  2.  
  3.    Forms![MainFormName]![SubFormObjectName].Form.Requery
  4.  
  5. End Sub
  6.  
Mary
Jan 12 '07 #5
NeoPa
32,584 Recognized Expert Moderator MVP
Thats a bit confusing since it looks like the whole code of the form. I'm just using the design view to create this form.

I tried creating a macro that just has Requery under Action and nothing in the control name field. In the sub form's properties under the events tab, I set this macro to the afterUpdate field. This works when I open the subform separately, I change the status to processed and after clicking elsewhere the record disappears from the list. When I go to my main form I get this error when trying to change a record though "You can't use the ApplyFilter action on this window". So I kinda got this to work, but not in my main form. Would any problems be caused by the fact that this whole section is in a tab?
You weren't supposed to look at just the first post!
The info, repeated here by Mary, is contained and explained in post #2.
Jan 12 '07 #6
Jarekb
3 New Member
I don't think that the SubForm control being on a tab makes any difference in this case.
Other than that I'm afraid I can't follow what you're saying at all :(
The problem I had was not knowing that you could click the "..." button in the properties and select code builder. Once I figured this out, I just added Me.Requery in the code for On Change. Now it works fine. Does it matter if I put that code under On Change or After Update events?
Jan 16 '07 #7
NeoPa
32,584 Recognized Expert Moderator MVP
That's a good question.
Now I need to go and check on that. We need the event which triggers when updates are completed on that control, not one that triggers after a character is added.
Jan 16 '07 #8
NeoPa
32,584 Recognized Expert Moderator MVP
The problem I had was not knowing that you could click the "..." button in the properties and select code builder. Once I figured this out, I just added Me.Requery in the code for On Change. Now it works fine. Does it matter if I put that code under On Change or After Update events?
OnChange triggers after every change to the contents, so would not be appropriate for you. You need to move it to the AfterUpdate event procedure. This is created just as easily (with the ... button etc).
Jan 16 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

4
7039
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the user enters the last qualifying field on the main form. In one case this works fine, the subform shows the data the user wants to update -- which means showing all the data put in previously (ie showing this via the requery and the continuous...
15
2991
by: sara | last post by:
Hi I'm pretty new to Access here (using Access 2000), and appreciate the help and instruction. I gave myself 2.5 hours to research online and help and try to get this one, and I am not getting it. Simple database: I want to have a user enter Supply Orders (just for tracking purposes) by Item. The user may also enter a new item - "new" is a combination of Item, PartNumber and Vendor - they could have the
6
2098
by: visionstate | last post by:
Hi there, I am building a database that requires cascading lists on a form. I currently have (I may be adding more later) 3 combo boxes on my form - Department, Surname and Forename. The user chooses the department they want and then the corresponding surnames from that department can be chosen from the Surname box and then the Forename depending on which Surname they chose. I then have a command button which produces the results of the...
9
9740
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a master-child link to the first subform. subform2 - Master Field: subTrainingModule.Form!TrainingModuleTopicSK Child Field: TrainingModuleTopicSK
11
7194
by: mrowe | last post by:
I am using Access 2003. (I am also using ADO in the vast majority of my code. I recently read a post that indicated that ADO is not all that is was initially cracked up to be. In the back of my mind I am wonder if this is causing my problem, but I don’t want to go through the work to convert to DAO unless I know it is truly in my best interest.) I am having problems getting a requery to show up consistently on a couple of forms. I have...
2
1014
by: Lyn | last post by:
Hi, I am using a form (FormA) to list the records in a recordset. In the FormA footer, I have an "Add" command button that opens a new form (FormB) modally which is used to input and save a new record to the table on which the recordset is based. On closing FormB after inputting a new record, I would like to refresh/requery the listing in FormA automatically so that it includes the new record. I don't seem to be able to get this to...
8
2492
by: Cerian | last post by:
Hi there, I'm having trouble getting my 3rd dependent combo box to work in Access 2003. I have three dependent boxes named cbogroup, cbosection and cbofunction. Each one is dependent on the selection made in the previous box. All of these appear on one form called 'records subform'. The information for each box is taken from a different table. The first from 'functional group' which has only 2 fields: 'group' and 'group code'. The...
2
1781
by: Ron | last post by:
Hi All, I've got a main form (frmMain) with 5 subforms on it. All subforms are linked to different hidden controls on frmMain. The purpose of this form is to record payments by 'source' (batches) so frmMain's source is a query on BatchPaymentID. New 'source' for payment, new BatchPaymentID. 1st subform (sfrmOne) is a client list of just the client's that would have that source of payment. Next subform (sfrmTwo) is a list of charges...
4
3439
by: JHite | last post by:
I am using Access 2003 on Windows XP. This is a simple database that contains “tblStaffers” containing names of the office staffers, “tblProjects” containing names of the office projects, and “tblStatusReports” containing the “StafferID” (link to Staffer table), the “ProjectID” (link to Projects table), a “Date” field, and a “Notes” field. There is a main form, “frmStaffEntry,” with a subform, “frmStatusReports,” for a user to...
0
10149
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9974
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11548
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8239
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6093
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4927
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4520
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3523
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.