Forms :: How To Allow Tables To Be Filtered In Runtime
Feb 16, 2015
I can open up my tables using the code below in a distributable runtime version, but I cannot filter and sort in the table. Right clicking does nothing.
Dim strTableName
strTableName = Nz(Me.cboTableNames, "")
DoCmd.OpenTable TableName:=strTableName, View:=acViewNormal, datamode:=acEdit
I know with a form we can select to allow filters in the form properties, but when the OpenTable command is used, how can we allow for filtering?
Is it possible to open the tables in a generic form that allows for filtering?
View Replies
ADVERTISEMENT
Mar 21, 2013
I have three linked tables [Regulator], [RuleBook] and [Rules] (each has a corresponding form for data entry).
In the "Rules" form, when you select name of the regulator, the rule books dropdown down is filtered to show only the rulebooks for that regulator. the code I use is:
Private Sub Regulator_Change()
Me.[Rule Book].RowSource = "SELECT [ID],[Rule Book],[Short Code],[Regulator],[RegName],[Short Form],[Active] FROM" & _
" [RuleBook] WHERE Regulator = " & _
Me.Regulator
Me.[ShortReg] = Me.Regulator.Column(3)
End Sub
Basically, if I select the FSA as the regulator, The Rule Books drop down is filtered to only show the FSA Rule Books. If I pick OFT, I get the OFT list etc. This all works fine.
In the [RuleBook] table, each entry has a yes/no tick box called "Active".
The reason for this being that the regulators change their rule books quite regularly, but from an audit perspective, I can't delete or overwrite the old ones once they are no longer valid.
What I want to do, is further filter the rule book list to those where Active=True so that when I select FSA, I can only choose from their current rule books and not the ones that are no longer relevant.
View 7 Replies
View Related
Feb 12, 2015
I am trying to create a saved export on a table i have. However i want to filter so when i do the saved export it exports the table with the filtered result only.However when i filter my table and export it and save the export. The first export comes out with the filtered results but when i go to my list of saved exports and export it again, it doesnt come filtered and its just an export of the whole table.
View 1 Replies
View Related
Feb 18, 2008
Hi Guys,
This is one of this only times i've had a problem whose answer i couldn't find on this or other forums, so here's the question.
My DBase links to the back end tables
tblBrkdn
tblBrkdnArchive
tblBrkdwnTradespeople
tblBrkdwnTradespeopleArchive
The following two tables are local, not linked
tblBrkdnArchiveTemp
tblBrkdwnTradespeopleArchiveTemp
After running through the following code, all of the four above mentioned linked tables are now local. It's vexing. I'm terribly vexed. If you can help, my status would chnge from vexed to joyous....:
Thx in advance...
' 1) Join all together (Each Table)
' Create two recordsets, One for the Brkdn set, one for the Tradespeople Set.
' Brkdn: Want it to be the Union of all records in (tblBrkdn, tblBrkdnArchive) without duplicating BrkdwnID
'Standard Union Query with no duplicates. Transferring data into a temporary table
SQLStr = "SELECT * INTO tblBrkdnArchiveTemp FROM ("
SQLStr = SQLStr & "SELECT tblBrkdn.* FROM tblBrkdn INNER JOIN tblBrkdnArchive ON tblBrkdn.BrkdwnID = tblBrkdnArchive.BrkdwnID "
SQLStr = SQLStr & "Union ALL "
SQLStr = SQLStr & "SELECT tblBrkdn.* "
SQLStr = SQLStr & "FROM tblBrkdn LEFT JOIN tblBrkdnArchive ON tblBrkdn.BrkdwnID = tblBrkdnArchive.BrkdwnID "
SQLStr = SQLStr & "WHERE (((tblBrkdnArchive.BrkdwnID) Is Null))"
SQLStr = SQLStr & "UNION ALL SELECT tblBrkdnArchive.* "
SQLStr = SQLStr & "FROM tblBrkdn RIGHT JOIN tblBrkdnArchive ON tblBrkdn.BrkdwnID = tblBrkdnArchive.BrkdwnID "
SQLStr = SQLStr & "WHERE tblBrkdn.BrkdwnID is null);"
DoCmd.SetWarnings False
DoCmd.RunSQL SQLStr
DoCmd.SetWarnings True
' BrkdnTradespeople: Want it to be the Union of all records in (tblBrkdwnTradespeople, tblBrkdwnTradespeopleArchive) without duplicating ID
'Standard Union Query with no duplicates. Transferring data into a temporary table
SQLStr = "SELECT * INTO tblBrkdwnTradespeopleArchiveTemp FROM ("
SQLStr = SQLStr & "SELECT tblBrkdwnTradespeople.* FROM tblBrkdwnTradespeople INNER JOIN tblBrkdwnTradespeopleArchive ON tblBrkdwnTradespeople.ID = tblBrkdwnTradespeopleArchive.ID "
SQLStr = SQLStr & "Union ALL "
SQLStr = SQLStr & "SELECT tblBrkdwnTradespeople.* "
SQLStr = SQLStr & "FROM tblBrkdwnTradespeople LEFT JOIN tblBrkdwnTradespeopleArchive ON tblBrkdwnTradespeople.ID = tblBrkdwnTradespeopleArchive.ID "
SQLStr = SQLStr & "WHERE (((tblBrkdwnTradespeopleArchive.ID) Is Null))"
SQLStr = SQLStr & "UNION ALL SELECT tblBrkdwnTradespeopleArchive.* "
SQLStr = SQLStr & "FROM tblBrkdwnTradespeople RIGHT JOIN tblBrkdwnTradespeopleArchive ON tblBrkdwnTradespeople.ID = tblBrkdwnTradespeopleArchive.ID "
SQLStr = SQLStr & "WHERE tblBrkdwnTradespeople.ID is null);"
DoCmd.SetWarnings False
DoCmd.RunSQL SQLStr
DoCmd.SetWarnings True
'delete everything from the four non-temporary tables
'tblBrkdn
SQLStr = "DELETE * FROM tblBrkdn"
DoCmd.SetWarnings False
DoCmd.RunSQL SQLStr
DoCmd.SetWarnings True
'tblBrkdwnTradespeople
SQLStr = "DELETE * FROM tblBrkdwnTradespeople"
DoCmd.SetWarnings False
DoCmd.RunSQL SQLStr
DoCmd.SetWarnings True
'tblBrkdnArchive
SQLStr = "DELETE * FROM tblBrkdnArchive"
DoCmd.SetWarnings False
DoCmd.RunSQL SQLStr
DoCmd.SetWarnings True
'tblBrkdwnTradespeopleArchive
SQLStr = "DELETE * FROM tblBrkdwnTradespeopleArchive"
DoCmd.SetWarnings False
DoCmd.RunSQL SQLStr
DoCmd.SetWarnings True
' 2) Paste the entire record set to each Brkdn table
'tblBrkdn
SQLStr = "SELECT * INTO tblBrkdn FROM tblBrkdnArchiveTemp"
DoCmd.SetWarnings False
DoCmd.RunSQL SQLStr
DoCmd.SetWarnings True
'tblBrkdnArchive
SQLStr = "SELECT * INTO tblBrkdnArchive FROM tblBrkdnArchiveTemp"
DoCmd.SetWarnings False
DoCmd.RunSQL SQLStr
DoCmd.SetWarnings True
' 3) Delete from Active & Archive Brkdn tables WHERE [DATE] < txtArchiveDate.Text
'tblBrkdn
SQLStr = "DELETE * FROM tblBrkdn WHERE ([DATE]<#" & dateStr & "#);"
DoCmd.SetWarnings False
DoCmd.RunSQL SQLStr
DoCmd.SetWarnings True
'tblBrkdnArchive
SQLStr = "DELETE * FROM tblBrkdnArchive WHERE ([DATE]>=#" & dateStr & "#);"
DoCmd.SetWarnings False
DoCmd.RunSQL SQLStr
DoCmd.SetWarnings True
' 4) Paste to Active Tradespeople table WHERE Associated Breakdown Record [DATE] >= txtArchiveBeforeDate.text
SQLStr = "SELECT tblBrkdwnTradespeopleArchiveTemp.* INTO tblBrkdwnTradespeople FROM tblBrkdwnTradespeopleArchiveTemp INNER JOIN tblBrkdn ON (tblBrkdwnTradespeopleArchiveTemp.BrkdwnID=tblBrkd n.BrkdwnID)"
DoCmd.SetWarnings False
DoCmd.RunSQL SQLStr
DoCmd.SetWarnings True
' 5) Paste to Archive Tradespeople table WHERE Associated Breakdown Record [DATE] < txtArchiveBeforeDate.text
SQLStr = "SELECT tblBrkdwnTradespeopleArchiveTemp.* INTO tblBrkdwnTradespeopleArchive FROM tblBrkdwnTradespeopleArchiveTemp INNER JOIN tblBrkdnArchive ON (tblBrkdwnTradespeopleArchiveTemp.BrkdwnID=tblBrkd nArchive.BrkdwnID)"
DoCmd.SetWarnings False
DoCmd.RunSQL SQLStr
DoCmd.SetWarnings True
' 6) Clean up: Delete all records from the temporary tables
'tblBrkdnArchiveTemp
SQLStr = "DELETE * FROM tblBrkdnArchiveTemp;"
DoCmd.SetWarnings False
DoCmd.RunSQL SQLStr
DoCmd.SetWarnings True
'tblBrkdwnTradespeopleArchiveTemp
SQLStr = "DELETE * FROM tblBrkdwnTradespeopleArchiveTemp;"
DoCmd.SetWarnings False
DoCmd.RunSQL SQLStr
DoCmd.SetWarnings True
View 2 Replies
View Related
Apr 30, 2014
I am close to finishing a new database. In this database I have some VBA code that does a bunch of stuff, one of those things is to check if a temp table exists, and if yes then it will delete it.
Once finished this database will be made available to a range of people via Access Runtime 2010. I'm just wondering will the VBA code that deletes a table work in a Runtime environment?
I guess I should also ask if a save import process will also run via Runtime.just need to make sure that the users that need to do this code have full access if its required.
View 4 Replies
View Related
May 14, 2015
I filter my table with a query - where the Invoiced Date is NULL. In the vba ADD RECORDS code I may INSERT new records which should then also appear - but are not showing up. The records ARE added to the table, but don't show up unless I close the form and reload it and then the query filter picks up the added records.
View 5 Replies
View Related
Feb 4, 2013
My office recently purchased Microsoft Access for our secretary to keep track of our contacts. No other employee owns Access so we have to distribute the tables through Access Runtime. However, there seems to be a problem.
I save and publish a database using the Packaging Wizard. I then send the associated folder with the install program to a computer which has Access Runtime installed on it. But, when I install the file I created with Packaging Wizard it just opens an Access window that is completely blank. It's actually the same thing that occurs when I try to open an Access file on a computer that doesn't have Access or Runtime installed on it at all.
View 7 Replies
View Related
Sep 24, 2014
I have a subform that has two fields one called 24 months(date field) and one called status(text field), what I am trying to do is after the suborm has been filtered if the date field and is <=date then it will place "expired" into the status text field.
View 2 Replies
View Related
Jun 10, 2015
I have a form [Art_DepartmentFilter] that has a subform [Art_ByRoomSubform]. The linked master/child fields are DeptID and RoomID.
There is a list box on the form that allows you to select the department, and this also updates a list box that shows the rooms in that department that have art in them.
I would like the user to be able to filter the form to show either all of the art in that department, or just the art in the specific room. I have two separate buttons, one for each filter (cmdDeptFilter, and cmdRoomFilter).
I realized I had to add the link for the RoomID in order to get the filter for the room to work (which it does nowoCmd.ApplyFilter , "[qry_artbyroom]![DeptID]=[forms]![art_departmentfilter]![textdeptid] and [qry_artbyroom]![roomid]=[forms]![art_departmentfilter]![textroomid]").
However, DoCmd.ApplyFilter , "[qry_artbyroom]![DeptID]=[forms]![art_departmentfilter]![textdeptid] and [qry_artbyroom]![roomid] like '*'" returns just the first room listed for the department, not all of the rooms.
How can I show all of the rooms for the department selected?
View 5 Replies
View Related
Oct 23, 2014
I want a form which allows data entry into a main table but also displays a list of records filtered from the same table. There is also an additional, calculated field displayed with the list.
The filter criteria are a date and a name, a list of which are in a separate table.They are separate fields for first and last name but i would like to filter with both and display them concatenated in the list.
View 6 Replies
View Related
Apr 9, 2014
I'm trying to open a form with filtered criteria using this code:
Code:
DoCmd.OpenForm "Edit_Mission", acNormal, , "[Report_Date]=# " & Format(Me.Date, "dd/mm/yyyy") & "# And [Supporter_Name]='" & Me.Supporter & "'"
it used to work on access 2010 but now on access 2013 I get a blank form.
View 2 Replies
View Related
Sep 24, 2014
I have a filtered subform that has a check box on each record. I want to be able to use an unbound checkbox to select all and have that selection updated in the table for each associated record.
View 4 Replies
View Related
May 13, 2014
I have a PIVOT table that is used to select courses. I have some vba code that exports this to pdf, but it exports the entire data not the filtered data. Is this possible just to export the filtered data?
View 8 Replies
View Related
Aug 3, 2015
I am currently developing a crude Contact manager database and need a quick way of entering data into a selection of records (around 1000 at a time). At the moment I am manually going through all records and changing the "DateLastEmail" field manually, which can be very tiring.
Any way to assign a button to change the field for all records to today's date or something of the like.
Currently I have a form which filters my subform. The subform resides as a seperate query and when the "Apply Filter" button is pressed it requeries with a change of .filter property, so I guess that all that needs to be done is to change all records that exist within the query, but I am stuck on a way to do this without manually entering it.
View 3 Replies
View Related
Nov 25, 2014
I want to open a report with the results from a filtered form.
I want to use a similar format to the attached Allene Browne search2000 as the base to filter the records initially, but not sure how to get the filtered results into a report and the most efficient way.
View 8 Replies
View Related
Sep 13, 2013
I have a form that displays records from a table.
When opened it displays all records (no selection yet).
I put would like to put 2 buttons to filter records (Male/Female).
I'm thinking of 2 possible options:
1-on click run a script that will close current form, then reopen it with selection criteria
2-directly apply a filter on the current form that would automatically refresh itself with the right records
Another (heavy, inelegant?) solution would be to create duplicates of this form. they would be loaded from separate queries that select the right records in either choice.
View 4 Replies
View Related
Sep 11, 2013
The table has PK and city column can be one of several. I need to create a filtered datasheet view (few columns only).
Since there are quite a few cities, I need to select one to display all the records in that city. My questions
Since it is a datasheet view I cannot use Combo Box. What to do then ?
If I use subform with a combo box, and bind the query in the subform with the selected combo text, it does not work.
here is the subform query
SELECT tblClient.ClientName, tblClient.HqCity FROM tblClient WHERE (((tblClient.HqCity)=[Forms]![frmSearchCity]![cboCity]));
I get nothing.....
View 8 Replies
View Related
Jan 9, 2014
I have a form with a subform. In the form header I have combo boxes for the user to filter data. I want to add a button that they would click to export the filtered records to a table. I have the following code and get the message that records were exported successfully but when I open the table they are not there. I don't get any errors when I compile the code but I also don't get any results in the immediate window either.
Code:
Private Sub cmdAddToTable_Click()
'Dim tmpRS As DAO.Recordset
'Dim tmpSQL As String
[code]...
View 3 Replies
View Related
Mar 9, 2014
Table: Transactions: ID,Date,Title,Category,Value, Budget Name
Table: Budget: Budget Name
Budget Years: Budget Name, Date From, Date To
Form entitles Budget, Fields : Date From, Date To, Budget Name
So within the form budget I have a subform which I want to group the categories and get a total value. THE tricky part is, I only want it to include values from the budget specified in the form and the date range of the form.
View 1 Replies
View Related
May 6, 2013
I have faced with a problem while i was filtering my main form.....my problem is when i filter the main or parent form the related sub-form also gets filtered how to manage the main form so that when i filter it the sub-form should not be filtered so that i can get the related record to my filtered one in the sub-form... as for the time being when i filter the main form the related record in the sub-form is not shown and when i press unfiltered on the sub-form its data gets appeared....
View 11 Replies
View Related
Apr 17, 2014
I have a form which displays records based on a selection from a list box on the form.
The default record displayed when I load the form is record 1 from the table, this is not an issue when I initially load the form but I also have options to filter the records displayed in the list box using various SQL statements, depending on the options selected.
However, when I apply one ofthese filters to the list box the default record displayed on the form still defaults to the first record in the table, which may not be included in the filtered list box.
Is there a way I can default to the first record listed in the list box rather than the first record in the table.
View 2 Replies
View Related
Sep 15, 2014
I am a novice and have been searching to no avail for a solution to my problem. I have a main form and a subform (datasheet view) of a table. In my main form I have various calculations which calculates the data from the subform (when auto-filtered). What I am trying to do is count the distinct [Call Number] reflecting the data from the subform into a textbox in the main form (when subform is auto-filtered).
View 14 Replies
View Related
Apr 11, 2014
Below is some code that I'm struggling with and I get an error message "Type Mismatch".
Description: The database contains multiple projects and the subset of each project is a release. The "PublishedNumber" can't be a duplicate within a release, but it can be a duplicate within the table where the data is stored. There can however be multiple occurrences of 0.
Here's my code:
Dim stLinkCriteriaRelease As String
Dim stLinkPublishedNumber As String
Dim DuplicateNumber As Variant
stLinkCriteriaRelease = "[AssociatedRelease]=" & [AssociatedRelease]
stLinkPublishedNumber = "[PublishedNumber]=" & [PublishedNumber]
[Code] ....
View 3 Replies
View Related
Sep 12, 2013
I have created a piece of code that filters a sub form of diary records using criteria the user has selected or entered. It was working fine when I made it a month or so ago and now is seems to be returning incorrectly filtered records, for example, I enter 2 dates to return all diary entries between the 2 dates. Yet it misses some records out that should be within the date range, and it sometimes include records that are outside the date range. I am also getting an error when I try and filter the diary entries via the supplier, "data type mismatch", here's the code that, bearing in mind, was previously working fine.
Code:
Public Function filter_diary()
Dim dbs As Database
'Dim qdf As QueryDef
Dim Sqlstr As String
Dim sqlstrwhat As String
[code]....
View 1 Replies
View Related
Dec 15, 2014
I've created a form with two textboxes and a listbox. What I want to do is to show in the listbox the registers filtered by the 2 textboxes. But I would like that the listbox refreshes while typping in the textboxes.It was no problem to do filtering with only one textbox. The rowsource of the listbox is a query in which I set in the criteria Like [Forms]![Form1]![Textbox1].[Text] & "*"Then I write the code for the change event of the Textbox1:
Private Sub Textbox1_Change()
Listbox1.Requery
End Sub
With this I have no problem. The problem is when using the 2 textboxes. I write the same in the criteria, Like [Forms]![Form1]![Textbox2].[Text] & "*", on another field but it doesn't work. I also write the code for the second textbox:
Private Sub Textbox2_Change()
Listbox1.Requery
End Sub
The listbox doesn't filter with both textboxes. When you type in one of them, the listbox filters from it, but when you type in the other textbox, the listbox shows the whole table filtered with the characters of the second textbox.
View 10 Replies
View Related
Oct 18, 2014
I'm constructing a database to record appointments. I want my users to input their appointments on one half of a form (I can manage that bit) but on the other half I want them to be able to see a list of the appointments they already have booked that day (with any patient) or what the patients already have booked that day (with themselves and any other therapists).
The appointment fields they will need to see are:
start time
end time
patient/therapist (depending on if they are viewing their own or the chosen patients' appointments
type of appointment (physiotherapy etc)
location
The date won't need to be seen but will dictate which day's appointments are listed.
At it's simplest I could get away with a list of the day's appointments for the patient and date the therapist has typed into the form to start the record.
Ideally I'd like them to be able to choose whether to see a list of the patient's appointments for that day or their own. If there's room I would display both.
Here's the final, 'moon-on-a-stick' bit... it would be great if I could show the appointments in time slots rather than just as a list. From what I can tell that's quite tricky to pull off but i thought I would ask anyway...
At the moment I don't even know what keywords to look up - is this 'embedding a report in a form' or 'inserting a filtered list' and so on.
View 1 Replies
View Related