Forms :: Recordset Of Subform Inside Another Subform Which Is Inside A Mainform
Dec 16, 2013
I'm having a problem with the syntax of a recordset of a Datasheet inside a subform which is also inside a Main Form.
Main Form - frm_1_0_LMS
Subform - frm_1_4_0_TeamApprovals
Subform(Datasheet) - frm_1_4_1_TeamApprovalsList
Here is my code:
Code:
Dim rs As DAO.Recordset
Set rs = Forms!frm_1_0_LMS.frm_1_4_0_TeamApprovals.frm_1_4_1_TeamApprovalsList.Form.Recordset
If Not (rs.EOF And rs.BOF) Then
Forms!frm_1_4_2_ApproveDeclineUserLeave.Controls("lblFiledDateLeave").Caption = rs!Leave_Date
End If
I am getting this error: Object doesn't support this property or method
I have a form (eg. frmMain) with a subform (eg. frmSub).
The subform is going to be a query which displays results based on criteria defined in the main form.
So say frmMain had a field called 'OrderDate'. When they typed an order date, all the orders on that date appear in the subform.
The way I have it set up at the moment is that the query criteria is like [forms]![frmMain]![orderdate]
Do this means that once the order date is entered - there is still no results in the subform because the query has already run when the form was opened and, as this field was then blank, no results were returned.
I would like to keep this setup, but - instead of having the subform set to the query, it would be set to another form which just has a commond button.
The user will then input the OrderDate - click the button (which is in the subform) and the query will run. This can be done easily. HOWEVER, is there a way for the query results to be displayed in that subform area after the button has been clicked instead of opening up a new form.
I know in web design you can target links to frames, so wondered if this was possible?
Is it possible to use recordsets inside an sql-statement how described in following example. the error message: access can't find the table or querydef.
Code:
public function useRS (RS_ext_1 as DAO.Recordset, RS_ext_2 as DAO.Recordset) as DAO.Recordset dim sql_RS_int as string dim RS_int as DAO.Recordset
sql_RS_int = "SELECT * FROM RS_ext_1, RS_ext_2 WHERE col1_ext1 = 1 and col1_ext2 = 5" set RS_int = CurrentDB().OpenRecordset(sql_RS_int) set useRS = RS_int.Clone
My Database is really simple, it contains 1 table (called Querys) and a form called Dashboard.
In my main form (Dashboard) I have inserted a sub form which shows all the records in my table (called Querys) when I use my main form and add a record this sub table can then be refreshed and it shows all my records.
This part is fine,What I would like to do is be able to select a record in my sub form and it show the record data in my main form. This would really speed up the navigation process as the database gets bigger.
I have a form which shows training events - these can take place over one or several days, and can be run by one trainer or several, so I have my basic Events Info in one table (EventID, EventType, Location, that kind of thing) and the 'Jobs' in a separate table (EventID, JobDate, TrainerID, etc)
The problem I'm having is that I want the List of Events to be sorted in order of their start date... which is on the subform, not the main form.
How can I go about it - and still leave both the main and subforms fully editable?
I have a Mainform [FrmReconcileMain] and it contains a Subform [FrmReconcilesub]
What I'm trying to is, on the Main form type in a statement date in textbox [TxtStatementDate].
I have a checkbox on my subform [ReconciledYN], along with a textbox [TxtReconcileDateSub]. when I click the checkbox, it simply pulls the date from the mainform and populates the date in the subform.
I've even tried experimenting on a simple form (with no subform) to see whats going on, but still I can't get it to work, even on a simple event such as this...
If [yourcheckboxname] = -1 Then [controlnametoupdate] = date() Else [controlnametoupdate] = ""
I have been fighting a problem with sorting the data in a subform that is in a datasheet. It is sorting the data automatically so the entries are not in the original order. Is there a way to disable the feature so that when I put data into the datasheet it will appear in the same order that it was originally.
I am looking for the ability to have a scrollable window inside of a tab.
My database is tabbed into categories of data.
One of these categories has more than the others.
I would like to create a rectangle inside the tabbed area which I can put the questions in but the box is too small, so instead of creating tabs inside another tab, id rather have a scrollable section inside in which I can put the questions in...
Code: Sub ClearDeck() Dim i As Integer Dim ToStay As Variant
'Because Access will not allow a Frame and all it's contents to set Visible = False 'Remove all Frame Controls except those to keep outside our Frame
[Code] ...
I'm getting RunTime Error 424 Object Missing on the line inside the if statement. Although it is getting .Controls(i).Name correctly and I would have thought Me is an Object? I also tried the complete Form name but still got the error.
I have a master form named frmCustomer. I then have a set of tabs (not the navigation tabs) embedded within frmCustomer. The tabs are Invoice (frmInvoice), Contacts *frmContacts), Notes (frmNotes) and Orders (frmOrders). All form are Single Form. There is another form named frmInv that displays an invoice in a formatted manner. frmINV gets its data from a q1uery called InvQ.
It has a criteria that reads [Forms}![frmInvoice]![Invoice_ID]. I placed a button on frmInvoice that calls frmInv. If I run frmInvoice separately outside the tab the correct invoice displays. If I click the buttom from within the tab I am asked to enter the vale of [Forms}![frmInvoice]![Invoice_ID]. How do I call the frmInv form from the tab?
I have a form with a list box. This list box has a row source that I've set as a query for five different fields with a where clause. This where clause should pick up a value that is already within the form. And this is where I think it's going wrong, because if returns no results, but if I set it to point at the same value from another form (previous to this one, it does work). So there is something about the order or something so that this variable isn't passed to my listbox when it executes.
So, my list box has: select ID, title from table where ID = [Forms]![CurrentFormName]![ID]
and it doesn't work.However if I add a text field and set that to point at =[ID] then this does display the ID. And if I amend my query to point at this text field using the same convention above, that doesn't work either.
I presume I am mis-referencing, or there is something in the order that the listbox loads and it does this before the ID is set?
On a Tab Control inside a from, I've created an Unbound Object Frame, referring to an MS Excel Work Sheet. The goal here is to link that Unbound Object Frame residing on the Tab Control and save the form/link.
Now, when I execute the code, the Object Frame is linked and updated, but when I close the form, the link inside the Object Frame is not saved! However, when I do the exact same thing without placing the Object Frame on one of the pages of the tab, so as regular control inside the form, all works fine.
The code is as follows (performed when I click the button);"OLETest" refers to the UnBound Object Frame placed inside the first page of a Tab Control inside the form.
Form_A (main form for the application - should always be open) Form_B (always open, but sometimes has visibility set to false) Form_C (opens from button on Form_B)
When I press the button on Form_B, the only code behind it is DoCmd.OpenForm "Form_C". This seems to hide Form_B, and open Form_C behind Form_A (which is the main form of the application) inside of an Access window.
I would like Form_C to open in front of Form_B. I suspect that I set up the form incorrectly or something when I created it, and it is therefore opening inside an Access window.
I have a main form with a control that can take one of three values. And I would like to add a subform that work as follows.
Selecting each value should change what the subform displays like this. Control Subform A Select * from TableA where Key = "A" B Select * from TableB where Key = "B" C Disable subform somehow because it doesn't apply
Could someone please provide some advice on how I could do this.
I am assuming Access cannot handle Many to Many relationships very well.
I have an Account form ("MainForm") with an embedded SubForm that displays only the Account Address with suite number, street number, street name, street type. Account to Address is a Many to Many relationship. My Account form's source is tblAccount, and the SubForm is built off of a query of 3 tables -- Querying Account, LinkTable, and Address table. The link between the SubForm and the "MainForm" is done via AccountID.
My problem is, when I query for an Address (say entering a street number of 25), I want to get back all the addresses with street number of 25 AND the corresponding Accounts that have street number 25 only
What it does is return the addresses with Street Number 25 and ALL the accounts regardless of what their addresses are!
Is there a way to do this?? Can I design a form without using a SubForm in this case, ie, display the account and its many addresses? Or does Access Forms not support Many to Many Relationships? I'm thinking the link table is causing the problems here.
Please advise -- this "simple" project is becoming quite the headache! :eek:
"edit" -- I also notice this problem with a 1 to Many relationship (the "many" portion being the subform)
I had a text box on a main form linked to a text box on a sub form using the following control source =Forms!Form![frm_Doctors_details subform].[Form].[Title]. This was working, however I had to play around with the subform alot and now the link isn't working. All i get in the field is #name?. Nothing has changed on the subform textboxs, just that I added a primary key to assist in the linking action bewteen forms. I can't for the life of me get it back to what it was . any ideas??
I have a main form which has a subform control in it. when the main form is opened the sub form control contains a list of events in a sub form (a summary view), for the person selected in the main form.
I want to change the subform to a different one which shows the whole event when i click in a field on the subform, based on the event i clicked in. ( i can do it by opening a new form but not with a new subform)
I can make the form change using the following code:
i'm working in access 97 and am having difficulties pulling a subtotal or referencing any fields on my subform on my main form. I've searched the forum and help and tried to apply the info provided, but i still can't seem to get it to work.
as far as i can tell this should work:
=[MySubForm].[Form]![TxtTotalStaffNumbers] but i'm still getting the dreaded #Name? error.
anyone got any clues as to what i'm doing wrong?
what about the case where the subtotal i'm referencing is a calculation such as =Sum([Quantity]*[FacilityArea]). Should i still be able to reference it on my main form by pointing to the name of the field?
I have a query (SelectedData_Query) , on which a form (SelectedDataQuery_SubForm) in datasheetview is based, which is placed on a form (NAWInvoerForm) where customer adress data is put in. When someone clicks new case button on the NAWInvoer_Form, another form (CaseDateTimeInfo_Form) is opened, data is entered, but when the "CaseDateTimeInfo_Form" form is closed, the data in the subform in datasheetview on the NAWInvoerForm is not yet refreshed. So I tried the following:
Private Sub Form_Close() '------------------------------------------------------------ ' RefreshNAWInvoerForm ' '------------------------------------------------------------ On Error GoTo RefreshNAWInvoerForm_Err
Which works just fine. After the form is closed, the name, adress and cases overview form is reopened and refreshed, thus the case that has just been created is shown nicely in the subform which is based on a query.
But it is starting to become bothersome, sometimes when I close the form in which I create a new case, I don't want to have the other form (NAWInvoerForm) reopening again.
So how can i make it so that when I close the form only the data in the "NAWInvoer_Form" is refreshed, without having to reopen the form again. I mean, in the background, the form is still open anyway. It just shouldn't keep popping up everytime.
It can't be hard, but I can't see it. I'm new at this. I have found some similar topics on this forum, but none which helps me out enough.
It should be something like:
On "thisandthatevent" do a "thisandthatcommand" on "thisandthatsubform" in "thisandthatform"
If I know how the syntax of that is done, it would help me out with some other problems I see coming in the near future. I've looked at, and tried some things based on this link: http://www.mvps.org/access/forms/frm0031.htm But without success.
How it works: You search for a User, and then you search for a Serial.Now, what if I want to edit the table? (inside the subform, the results). I added an openRecordSet, and Parameters, but I still get the error saying that Recordset cannot be updated.Why? I opened and sent parameters but still fails.
May be this is easy for your guys. I want to freeze or lock the mainform data fields while allowing users to input, edit, delete data on a subform. I tried to change mainform properties so it can not edit, add or delete data on mainform. By doing so, I cannot do anything with subform, it seem read only as well.
I want it to filter out any matches between the 7 fields. Here is my code:
Code: Private Sub Command19_Click() Dim strFilter As Variant, _ strSDate As String, _ strEDate As String 'check Text13 Text13.SetFocus 'set focus to Text13 to be checked
[code].....
It will only filter for Build Date 1 and not for any of the other fields.