473,657 Members | 2,609 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Subform refresh and query view.

23 New Member
Hello again,

I have a subform that gets populated from a records query. I needed the subform to refresh once a record is added via another form. I accomplished this by re-running the query for the subform upon closing the record addition form. It works like a champ, except I also the get the query datasheet view in addtion to the subform.

I am sure there is an obvious answer, that I am missing. Please let me know what other information you may need to help illustrate the problem.

Regards,
Willie
Sep 30 '09 #1
28 5470
ChipR
1,287 Recognized Expert Top Contributor
Save the query, set the subform source to the query, and after the data set is changed, call
Expand|Select|Wrap|Line Numbers
  1. subformControl.Form.Requery
Or, just wait the preset amount of time for Acess to update itself.
Sep 30 '09 #2
Rotorian
23 New Member
Thank you for the reply.

I did that, but I still get the query data sheet view on top of the subform being refreshed. I guess I didnt put it in the right spot. Here is the button code.

Expand|Select|Wrap|Line Numbers
  1. On Error GoTo Err_addrecord_Click
  2.  
  3.  
  4.     DoCmd.GoToRecord , , acNewRec
  5.  
  6. Exit_addrecord_Click:
  7.     Exit Sub
  8.  
  9. Err_addrecord_Click:
  10.     MsgBox Err.Description
  11.     Resume Exit_addrecord_Click
  12.  
  13. End Sub
  14. Private Sub OpenAddRecords_Click()
  15. On Error GoTo Err_OpenAddRecords_Click
  16.  
  17.     Dim stDocName As String
  18.     Dim stLinkCriteria As String
  19.  
  20.     stDocName = "tologentry"
  21.     DoCmd.OpenForm stDocName, , , stLinkCriteria
  22.  
  23. Exit_OpenAddRecords_Click:
  24.     Exit Sub
  25.  
  26. Err_OpenAddRecords_Click:
  27.     MsgBox Err.Description
  28.     Resume Exit_OpenAddRecords_Click
  29.  
  30.     subformControl.Form.Requery
  31.  
  32. End Sub
Sep 30 '09 #3
ajalwaysus
266 Recognized Expert Contributor
The line will only execute OnError where it is right now, put it as follows..

@Rotorian
Sep 30 '09 #4
ChipR
1,287 Recognized Expert Top Contributor
First, replace "subformControl " with the actual name of the subform control on your form. Second, what is this "tologentry " you are opening?
Sep 30 '09 #5
Rotorian
23 New Member
Hmmm okay, did this:




"code deleted to save space, sorry"

Still get datasheet ivew, and now I get error "Object Required" upon clicking the button to add record.
Sep 30 '09 #6
Rotorian
23 New Member
You know I think I am going about this the wrong way. I posted the vb code for the button that is open a records entry form. Where I think i should post the code for the records entry form for an "OnClose" event. Let me double ck.
Sep 30 '09 #7
ajalwaysus
266 Recognized Expert Contributor
Also I think you need to address what ChipR is asking, before we can help you further.

-AJ
Sep 30 '09 #8
Rotorian
23 New Member
Okay form "tologentry " is the medium for updating records in table "tolog" in the "OnClose" event for "tologentry " I put this code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Close()
  2.  
  3. historyrequest SubForm.Form.Requery
  4.  
  5. End Sub
This should refresh "historyreq uest subform" within another form, right? However, it is not happening, and I am getting the following error:

"Run-time error: 424 Object required"

When you guys ask for control I assume you mean the query that populates the subform? Under record source? for the subform properties. I think I am missing the obvious somewhere.

Sorry.
Sep 30 '09 #9
Rotorian
23 New Member
Please note I replaced the error code. In case anyone read it before my edit, apologies.
Sep 30 '09 #10

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

Similar topics

4
3808
by: wayne dooley | last post by:
This should be easy. I have 2 tables - CUST and SUBS, which have a 1 to many relationship. I created a form to show fields from CUST and a subform to show those in SUBS. The 2 tables are related on SUBSNO, and the data source for each is the table (not a query). It behaves wonderfully, except I can't seem to change the layout of the subform in design view. I make changes and can see them in design view but in form view it reverts back...
25
10220
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the data in each record, which includes the ID of the father and the mother (who also have records in the table). One record per form. I have a Tab Control in the form, and in one of the tabs I have a subform (sfmSiblings) in which I wish to list...
2
5775
by: Smartin | last post by:
Using Access 97 I am trying to create a form that allows for user entry of search terms and displays a table of results. I thought I could accomplish this using a subform but it isn't quite doing what I want it to do. What I have so far: Fields to enter search terms Subform bound to a query
4
12939
by: Wilkesy | last post by:
Hi all, This is really begining to do my head in!!! I have a query that im trying to run, but i want it to refresh a subform, not open up into a new window. I have a CD database and so far i have my main form with an unbound box where the user can input the artist name, i then want the subform, which is all the required fields from the query, to be updated based on what the users inputs into the unbound box. I can get the data to...
7
4089
by: SBC News Groups | last post by:
I have a form that the user enters some information on and then clicks a button to save the record. I do with the following line: DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 Once this line executes, I have a sub form that I want to "refresh" because the newly saved information should now display on the sub form. I am trying to do this with this line: Forms!.Requery
1
1349
by: Lori2836 via AccessMonster.com | last post by:
Can someone help. I'm afraid I'm not too good at Access. What I'm trying to do is create a main form with a subform. The subform is "Search by Item Desc", which the record source is a query called "Item Desc". I want to have 2 fields in the Detail section of the main form.......Item Desc and Part Number, where you can enter an item desc or part number, such as "Specials" and have the subform below show just the parts and information...
1
7029
by: jeffro | last post by:
I have a database used for recording survey data. In the database, I have a form that displays a survey participant and a subform that is filled in by selecting a question from a looklist and then a response. The questions are held in a table and they are always the same. This is what I want to do. I want a button on the main form that can be clicked, When click, It will populate the survey detail table with the id of the record...
1
5421
by: Stinky Pete | last post by:
Hi everyone, I have been updating a file that uses a main form that contains a subform (as a datasheet). The main form really does not do anything on opening except maximizes to the users screen size. The subform however runs an "embedded" query (cause I don't know the right term) to show a list of records based on the embedded query. BTW, by embedded, I'm indicating the form does not run an external query but uses the query included...
1
19701
by: Simon van Beek | last post by:
Dear reader, After same changes it is required to requery (refresh) query in a sub form. The code below is not working:
0
8397
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
8827
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...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7333
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
6167
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
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4158
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...
0
4315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.