I am trying do display some data in a continous subform which is part of an unbound form.
The master form is supposed to display a error discription window. To do this I call the following sub procedure -
-
Public Sub display_error_payadvice( LegacyEmpNumber As String, FullName As String, EmployeeNumber As String )
-
-
DoCmd.OpenForm "ErrorPayAdvice"
-
Forms!ErrorPayAdvice.[employee Number] = EmployeeNumber
-
Forms!ErrorPayAdvice.[Full Name] = FullName
-
Forms!ErrorPayAdvice.[Legacy Employee Number] = LegacyEmpNumber
-
DoCmd.OpenForm "ErrorPayAdvice"
-
-
The 2 continous sub forms are based on the following queries -
-
SELECT PAY_RUN_RESULTS.ELEMENT_NAME, Sum(PAY_RUN_RESULTS.AMOUNT) AS AMOUNT
-
FROM PAY_RUN_RESULTS
-
GROUP BY PAY_RUN_RESULTS.ELEMENT_NAME, PAY_RUN_RESULTS.PAY_ADVICE, PAY_RUN_RESULTS.EMPLOYEE_NUMBER
-
HAVING (((PAY_RUN_RESULTS.PAY_ADVICE)='D') And ((PAY_RUN_RESULTS.EMPLOYEE_NUMBER)=Forms!ErrorPayAdvice![Employee Number]));
-
-
The Master form displays the employee number, name details and legacy employee number Ok but the subforms do not. If I open the subforms separately, after entering a value for the employee number parameter, the forms display the correct data. If I right click into the subform rectangle on the screen and select the 'Remove Filter/Sort' the data then appears. I have looked through the properties for the subform but I cannot find a Filter/Sort property. What do I need to do in order to get the subforms to work?
The version of Access I am using is 2003 on Windows XP.
5 2822
I am very confused as to what you are doing or trying to do.
Also, what you are trying to display.
Maybe it is just me, but I could use some more specific explanations.
Nick
Ok.
What should happen is that the sub procedure
sets some text items on on the form 'ErrorPayAdvice '
The form is then opened and the and the records in the subform displayed. The subform is based on the query shown and returns rows related to the the employee number in the master form.
Hi. I suspect that you are running into difficulties because at the time the form/subform combination is opened the unbound field Employee Number has no value set, so the underlying query you list returns no records. You should be aware that the sequence of events that occur when a form opens means that the recordsource for the subforms (the query you list) will be evaluated before your sub display_error_p ayadvice updates the fields which are supposed to filter the subforms.
Your second call to the OpenForm method in line 7 will not help you here, as the form is already open from the call in line 3. The second call is simply redundant.
To resolve this you will need to requery each subform after you set the field values in the main form within your subroutine. This refreshes the recordset which should now filter according to the employee number that is now present in the form. -
Forms!ErrorPayAdvice.[employee Number] = EmployeeNumber
-
...
-
Forms![First Subform Name].Form.Requery
-
Forms![Second Subform Name].Form.Requery
-
You will need to substitute the actual names of your subforms in the form field references for the requery calls above.
There are other ways to tackle this (by setting the recordsource for each subform to an SQL statement built in your code, for instance) but the requery method should at least resolve why you cannot see any records at present.
-Stewart
Thanks Stewart for your reply
Tried your suggestion but I am getting a Run time Error 2450
'Microsoft Office Access Cannont find the form 'Pay Run Earnings New' (this is one of the subforms) I think this is because the subform is not open at the time because I got the same error when I tried setting the values of the text items in the main form before the 'DoCmd.Openform
Thanks Stewart for your reply
Tried your suggestion but I am getting a Run time Error 2450
'Microsoft Office Access Cannont find the form 'Pay Run Earnings New' (this is one of the subforms) I think this is because the subform is not open at the time because I got the same error when I tried setting the values of the text items in the main form before the 'DoCmd.Openform
Apologies, I missed out the form name from the skeletons: - Forms![ErrorPayAdvice]![Pay Run Earnings New].Form.Requery
-
Forms![ErrorPayAdvice]![Second subform name].Form.Requery
-Stewart
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Alex |
last post by:
Subject: Looking for an XML (database-based) Query Reporting
Tool/advice
First off, let me apologize if this thread is somewhat off topic...
PLEASE REPLY TO: xml@solex-bi.com
I am looking for a way to query XML documents stored in an Oracle 9i
database, contained in an unstructured CLOB column, much like one would
with a traditional BI query reporting tool, but using XPath or XQuery
|
by: istorehere |
last post by:
Hi there,
I have created a subform with query. but it doesnt allows me to
add/edit records.
i have two tables.
Items : Item_code,ItemDesc,Reference
Order : Orderno,Item_code,Qty
|
by: mnms |
last post by:
Hi,
I'm trying to create an "overview" form. And I haven't been able to figure out how to get Access to do what I want yet.
Basicly what I want, is to populate a subform based on a field selection. In other words, I have several fields like colour, shape, location etc. on my Main form. Now I want to add a subform to my unbound mainform, showing what I have in a table, depending on what is selected in the fields.
So if I choose red,...
|
by: NJonge01 |
last post by:
Great thanks to all the helpful responses I've read! Recently using MS Access after a lengthy (7-10 years) away from the tool. I apologize for posting a question that for all intents & purposes appears to have been answered several times. Unfortunately, I've tried nearly a dozen approaches that seem to work for others on this board with similar (nearly identical in some cases) problems.
I would like to navigate through records on a subform...
|
by: shreyansghia |
last post by:
Hello ,
I am using MS Access 2007. Now if i ve a subform based on a table, filtering the subform is extremely easy . I only ve to click the relevant column head on the subform and check/uncheck the required records (clicking on the column head would yeild a drop down list).
However , since my subform is based on a query , i cannot avail the filter option using the above method. I get the error no 3075.
Can somebody please help me...
| |
by: MikeMikerson |
last post by:
Hello,
I am need to create a subform (no problem) of a form based query (a problem).
I need a form that will prompt the user to enter in a name, and the form will then display a query of the persons transactions.
The ideal situation would be that the executed query would remain as part of the record because there will be many of these "searches" stored within this form.
I have:
|
by: daleshei |
last post by:
I have a combo box with list all the queries I have on my database:
Form is called: frm_qry_slct
Combo box (Unbound): Combo23
RowSourceType: Table/Query
RowSoource:SELECT FROM MSysObjects WHERE =5 And Like "qry_#*" ORDER BY ;
Then my SubForm
|
by: csolomon |
last post by:
Happy Hump Day!
I was wondering if it would be possible to some how resize my subform
based on the number of records it holds. I have a subform that I
populate via a non-updatable query. It just shows the user what he/she
has ordered. Based on this information, I would like for the user to
just be able to view the information with out having to scroll. can
this be done?
Thanks
|
by: kashif73 |
last post by:
Hi,
I have a subform (datasheet view) on my Mainform, where a user can enter information. I need help on how to display the required number of rows in my subform based on the number selected in the dropdown box on my mainform. Please see the attached GIF. for example if a user selects 5 from the dropdown then automatcially the subform below should display 5 rows for entering data, with a default value of "UNKNOWN" in each column.
many...
|
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,...
|
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: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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: 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?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |