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
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 - subformControl.Form.Requery
Or, just wait the preset amount of time for Acess to update itself.
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. - On Error GoTo Err_addrecord_Click
-
-
-
DoCmd.GoToRecord , , acNewRec
-
-
Exit_addrecord_Click:
-
Exit Sub
-
-
Err_addrecord_Click:
-
MsgBox Err.Description
-
Resume Exit_addrecord_Click
-
-
End Sub
-
Private Sub OpenAddRecords_Click()
-
On Error GoTo Err_OpenAddRecords_Click
-
-
Dim stDocName As String
-
Dim stLinkCriteria As String
-
-
stDocName = "tologentry"
-
DoCmd.OpenForm stDocName, , , stLinkCriteria
-
-
Exit_OpenAddRecords_Click:
-
Exit Sub
-
-
Err_OpenAddRecords_Click:
-
MsgBox Err.Description
-
Resume Exit_OpenAddRecords_Click
-
-
subformControl.Form.Requery
-
-
End Sub
The line will only execute OnError where it is right now, put it as follows.. @Rotorian 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?
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.
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.
Also I think you need to address what ChipR is asking, before we can help you further.
-AJ
Okay form "tologentry " is the medium for updating records in table "tolog" in the "OnClose" event for "tologentry " I put this code: - Private Sub Form_Close()
-
-
historyrequest SubForm.Form.Requery
-
-
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.
Please note I replaced the error code. In case anyone read it before my edit, apologies.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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...
|
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...
|
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
|
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...
|
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
| |
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...
|
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...
|
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...
|
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:
|
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...
|
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...
| |
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,...
|
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...
|
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...
|
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...
|
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();...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |