Setting A Filter On Dynamically Created Table?
Apr 23, 2015
I am currently working on a Database to automatize some process.
The User can import a CSV (Text) File via a DialogBox, which gets imported into a Table. After this, the content has to be filtered, setting conditions on 4 different rows. The new Table gets exported into a new CSV (It has to be CSV, since it later gets imported into SAP)
How can I set a Filter on a dynamically created Table (using VBA)?
Best case would be to save the filter into my Import spec, but Access doesn't seem to have this option (?)
View Replies
ADVERTISEMENT
Mar 25, 2014
I currently have a Job Management System where the Customer Order Form displays all jobs via a main form and an order details subform. This form is used for inputting new jobs and for viewing existing jobs via links from other reports such as a job schedule or customer orders report. It is always reached via a clicking of a "New Customer Order" Button where the form is filtered to new record or via double clicking on an order number in another screen and filtered via the order number.
I am now in a position where the database is growing too large and I want to archive the data in the Orders / OrderDetails Tables into Financial Years and put them in a separate backend database. However the jobs will still need to be viewed via the customer order form in order for them to be duplicated the following year.
I have created a union query of the PreviousFY and Current Orders to allow the "search jobs by customer" query to work. This works fine, but I now need to make the record source of the Customer Order form dynamic.
I have created a CurrentFY query to feed the form if it is a current job and a PrevFY query if it's from the previous FY.
I have written code to check the OrderDate against the financial year to work out which database the job is from and set recordsource according to that result. This is currently in the OnCurrent event as I also have other code there that checks details of the order to determine if fields should be editable.
However I am finding that when I parse the order data between the forms the "new record" command or the order number is not being retained or checked. If this because I don't have a recordsource set when it opens?
I tried setting the recordsource as the currentFY on open and then do the check but that didn't work.
View 1 Replies
View Related
Oct 18, 2014
I am trying to add a feature in my database dashboard that shows a list of hyperlinks that are the most frequently used forms and reports based upon the user. I can figure out how to capture the event each time the form or report is opened and update a record to increase the count, and build a recordset that will query the table filtering by user and order by frequency...
However, I am stuck on building the hyperlinks that will point to the correct form or reports dynamically.
Specifically, I am not able to update the subaddress using VBA. I get an error that the hyperlink cannot follow to the new form...
Here is my code:
Code:
Private Sub Form_Load()
Dim strUser As String
Dim strApp As String
strUser = Environ("username")
strApp = "frmTest1"
Me.txtUser = strUser
Me.txtLink3 = strApp
Me.txtLink1 = strApp
Me.hypTest.Hyperlink.SubAddress = strApp
End Sub
View 3 Replies
View Related
Aug 19, 2014
I'm trying to set a filter with a command button. I've tried to do it like the examples I've read on numerous sites, but I can't seem to get the filter set. The code that seems most like the examples to me is:
Me.Filter = "[chkPaid] = 0"
Me.FilterOn = True
When I run this I get a box telling me to enter a parameter value for chkPaid. chkPaid is definitely the correct name for the checkbox control on the form. I've tried many variations with and without the square brackets, but as long as I have [chkPaid] inside of quotes I get the Enter Parameter box. If I leave the quotes off I get no parameter value request, but it doesn't set the filter either.
View 3 Replies
View Related
Aug 26, 2014
I am trying to set a filter on a form with VBA using variables and having no success at all. The code I tried last, which seemed to be "close, but no cigar", was:
Code:
Dim sFilterValue As String
Me.FilterOn = False
sBiller = Me.txtbiller.Value
sLastSource = Me.txtbiller.ControlSource
sLastSource = "[" & sLastSource & "]"
sFilterValue = sLastSource & "=" & sBiller
Me.Filter = sFilterValue
Me.FilterOn = True
sLastSource and sBiller are global variables. When I debug this code the sFilterValue is exactly what I would plug in manually and the Me.Filter shows up as "[Field Name] = Filter Value". But it crashes on Me.Filter = sFilterValue. I have tried all sorts of combinations but nothing I've tried works. What is the proper syntax for using variables as filters?
View 2 Replies
View Related
Apr 24, 2015
I have a report which is opened using a DoCmd.OpenReport. There's a criteria string which filters the main report - this works fine.
There's now a requirement to place a summary subform at the beginning of the report, in the report header. I need that summary to use the same criteria string as the main report.
For the main report's OnLoad I put : Me!Expenditure_By_Type_Subreport.Report.Filter = Me.Filter
But I get the error message:
Error 2101. The setting you entered isn't valid for this property.
I tried it the other way round as well - in the OnOpen of the subreport I tried : Me.Filter = Me.Parent.Filter
And it gives the same error.
When I just a manual Filter change such as : Me.Filter = "Project_ID Is Not Null"
View 3 Replies
View Related
Sep 19, 2014
I'm working on a form that when opened has a pop up filter that asks you to enter "1, 2, 3, 4 or 5". These numbers have to be equal to an actual word within the form. For example, on the form we have a box called "business unit". One of the options in "business unit" is "Human Resources".
I want to set 1 = to Human Resources so that way in the filter box all a person has to type is 1, and all of HR's records will pop up. The reason for this is we are trying to eliminate typing as much as possible.
View 1 Replies
View Related
Dec 15, 2014
I have a report, on a control tab, on a main form.
On the form are two buttons: one to show all items, and one to filter them based on a boolean field called showitem.
The buttons work with the code below.
What I want to do but cannot seem to figure out is to have the report default to no filter.
The bound query has no criteria.
I'm trying to set the filter property via the on open or on load event and even if I isolate the report, cannot seem to reach it.
Code:
Private Sub b_hide_items_Click()
Me.Profile_Timeline_wNotes_subreport.Report.Filter = "timeline.showItem <> 1"
Me.Profile_Timeline_wNotes_subreport.Report.FilterOn = True
Me.Profile_Timeline_wNotes_subreport.Requery
End Sub
Private Sub b_show_all_Click()
Me.Profile_Timeline_wNotes_subreport.Report.Filter = "timeline.showItem = 0"
Me.Profile_Timeline_wNotes_subreport.Report.FilterOn = False
Me.Profile_Timeline_wNotes_subreport.Requery
End Sub
View 14 Replies
View Related
Sep 23, 2007
Dear Access Expert
I wanted to know if it is possible to change the name of the Table which is going to be created using a Make-Table Query via code (VBA).
For example if my Make-Table query currently creates a table with the name "Table1" I want to change it to name "Table2" and then change it Back to "Table1" or "Table3" etc.... depending on the users selection.
View 6 Replies
View Related
Jul 19, 2012
I have two tables. The first one is as follows:
MP No (Primary key), Sales, Date Entry, Specs, Email
The second Table is as follows:
MP No, Quantity, Description, DWG, Price
There is a "one-to-many" relationship between the two tables through the MP No field so whenever I go to the first table there is a sub-table for each MP No. Correct?can I create an extra sub table under the sub table already created?
View 10 Replies
View Related
Feb 23, 2007
I'm using access2003 and i want to organize a large amount of files in my company. There are thousands of files and I'm breaking the files up based on the dates. I want to create a table that automatically looks in each folder and links the job file with the job folder. This way I can create a custom query so a user just types in the job name and it will display what folder it is in. Can anyone out there help? Thanks
View 3 Replies
View Related
Mar 12, 2013
I have a database with the following tables (among others):
tbl_Projects
tbl_Staff
tbl_ProjectsStaff
tbl_Payroll
tbl_Training
tbl_Clients
tbl_ProjectClients
tbl_ClientContracts
tbl_CostEstimates
As you can see I created two linking tables (project/staff and project/client).After that I linked other tables to the liking table. For example, tbl_Payroll and tbl_Training are linked to the tbl_ProjectStaff primary key.
I don't know much about access so I wanted to check if this is a correct design. I create forms that work well, but I noticed that the linking table doesn't have any data in it. The payroll table and the training table have the staff iDs and Project IDs but the tbl_ProjectStaff is empty.
View 14 Replies
View Related
Feb 5, 2008
Hi,
I am trying to create a series of MS access tables from within a SQL 2000 DTS package. The names of the tables reflect the date range of the data within them. Creating the "Create table ddmmyy ...." statement isn't a problem (full code below), but doesn't run as it creates a Jet error - "Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'. Does anyone know if what I'm trying to do is possible.
Before anyone suggests it, yes I have posted this on SQL server forums.
declare @TheName char (8)
,@Cmd char (500)
select @TheName = (select max(LastRunDate) from NSP_Analysis_Dates)
select @Cmd = 'CREATE TABLE `NSP_Analysis_' + @TheName + '` (`TYPE` VarChar (200) NULL, `VENDOR_NO` VarChar (10) NULL, `VENDOR_NAME` VarChar (50) NULL, `AMOUNT_CLAIMED` Currency NULL, `REGION` VarChar (100) NULL, `CLUSTER` VarChar (100) NULL, `PLANT_CODE` VarChar (15) NULL, `PLANT_NAME` VarChar (50) NULL, `DATE_OF_SERVICE` DateTime NULL, `STATUS` VarChar (200) NULL, `TICKET_NO` VarChar (20) NULL, `NOTES` VarChar (255) NULL, `DATE_ENTERED` DateTime NULL, `AuthorisedByName` VarChar (50) NULL)'
sp_executesql @Cmd
View 1 Replies
View Related
Oct 30, 2006
I have a pivot table, It is associated with a table in an another database (access database ofcourse!). What I am doing is that I am inserting new data on a click of a button in that table but the pivot table shows the same old data, it does not refresh..!!
How can I do that??
View 5 Replies
View Related
Jan 11, 2007
I have tables in a database that are not ticked replicable at present (tick button is greyed out), this is causing
the records in the table to become scrambled when we attemp to replicate the database.
Any advice please, with over 50 tables in the database we don't feel inclined to start from scratch.
Any help appreciated.
Matthew
View 7 Replies
View Related
Feb 24, 2006
Anybody able to help me with this. I think there should be a simple solution to it, but it eludes me at the moment. Basically, I have created a form in MsAccess with alot of vb script on it, but
now I realise that I have to add more fields to the source table.
If I insert a new unbound text box onto the form, how do i bind it to
the new field in the source table. is there a formula that I should
use? When I look at the dropdown in the control source property, it
only gives me the fields that were in existense at the time the form
was created?
your help appreciated
thanks
View 3 Replies
View Related
Oct 6, 2005
I have just split my multi-user DB into Front end and back end. All appears fine apart from there is code in the autoexec module that checks to see if a particular table has been updated today. Basically the first person to login to the DB each day will run this procedure without realising. Now I have FE & BE however, because the query used by the autoexec module is a "Make table" query rather than delete all data and use an append query, every person logging in is running the update each day if it is the first time they have logged in on their PC and they are getting a local table on each of their computers. Is there any code that will create the table in the networked location (when the first person of the day logs in), rather than me having to change all my "delete table" queries to cleardown data and then re-append updated data?
There are quite a lot of delete queries in my DB and I am now worried that I shouldn't have split the DB as I may have caused myself loads of work which I don't have time to do.
I have looked on other threads but cannot find the answer and would greatly appreciate some help
View 11 Replies
View Related
Mar 9, 2007
Is it possible to have the Date/Time appear as part of the name of a table? I don't want to create and rename a table I want to run a Query that will create a Table that will have the name + date or just the date.
Example
"Todays file 20070308 11:10:34 AM"
or
"2007080308"
Or
"2007080308 11:10:34"
View 3 Replies
View Related
Jul 10, 2013
I've been having problems merging a spreadsheet with data into an already created table..
The main things in common is the "MC", "First Name", "Last Name".
I'm trying to update dates etc that are on the spreadsheet exported from another database, and update my datebase with those new dates..
View 14 Replies
View Related
Apr 7, 2014
I have several lookup tables in an Access database. These tables are used to populate fields in the main table and act as filters for viewing record subsets.I want to create a form that does the following:
1.) List the lookup table via a combobox.I was able to accomplish this with the following code:
Code:
SELECT MSysObjects.Name AS [Table Name]
FROM MSysObjects
WHERE (((MSysObjects.Name) Like "tblJob*") AND ((MSysObjects.Type)=1) AND ((MSysObjects.Flags)=0))
ORDER BY MSysObjects.Name;
2.) When a table is selected from the combobox, display the table in a subform for updating.
View 7 Replies
View Related
Dec 4, 2006
I want to automatically hide all the tables in the database, and automatically hide any new tables that are created, imported thereafter, except one mastertable.
How do i achieve this?
View 4 Replies
View Related
Sep 13, 2007
Hello all,
I have a temporary table with Yes/No fields (F101,F102,F103,....etc).
In another table i have a field called ProductCode with values (101,102,103,....etc)
Is it possible to append(or update) the records of the temp table with criteria on "F" &ProductCode field? (For example if ProductCode=101 then F101 sets to yes)
Thank you in advance.
View 4 Replies
View Related
Jan 13, 2008
Okay I had an idea and I thought I might get ffedback as I am relatively new to this. I went through a period a couple of years ago when I used access alot and was becoming familiar with VBA etc but I havent touched it in 2 years so Im pretty rusty.
I am running a study and need to have to create a database that:
a. collects data about participants
b. Has a number of questionnaires (5), each of which can be filled out by participants.
THe main table has a number of fields that collects info about the participants the most important of which will be the ParticipantID - an automatically generated number which is my primary key.
In table 2/form 2 I will host questionnaire one. This will be linked to Table 1/Form 1 (Particpant Information) by this tables primary key - also the Participant ID. The relationship will be 1:1. Each participant can only have one Participant ID and will only need to fill out questionnaire one once.
Is it possible that when I add a new participant to the Participant Information table/form I also automatically create a record in Table 2/Form 2 (Questionnaire 1), as well as Table 3/Form3 (Questionnaire 2) and so on so that they have the same ParticipantID...?
I was reading a similar query somewhere else and they said to use the Form_AfterInsert Event command? Is this right (see here http://www.pcreview.co.uk/forums/thread-1687644.php)?
I feel a bit stupid but I am willing to learn and try new things Once I get started I think I will be okay. If you could steer me in the right direction it would be much appreciated.
View 12 Replies
View Related
Jul 17, 2014
I created a table in MS Access using a Lookup & Relationship data-type. This means that my record cells call upon a particular table for values. It creates a LIST of values for that cell.When I query a particular value in this table I get every possible combination of the value. My query and code are below:
OR,
SELECT MainT.Content.Value, MainT.Source, MainT.[Entities Impacted].Value, MainT.Update,
MainT.[Divisions Impacted].Value, MainT.Announced, MainT.Effective, MainT.Stakeholders.Value,
MainT.[Ref#ID], MainT.[Issuing Agencies].Value
FROM MainT
WHERE (((MainT.Content.Value) Like "*" & [Forms]![SearchF]![ContentCB] & "*" Or (MainT.Content.Value) Is Null)
[Code] .....
This means that if I query STATES: "California", I'll get back every possible combination that exists with the name California in that particular field.The issue with this is that I'll get MULTIPLE primary key values rather than just 1. So, if one record, under STATES has California in it, but the other fields in that record have the Lookup & Relationship data-type, then every possible combination of that record will query instead of the multiple field-values form that you'll see in the table I am querying.
notice that my primary key (REF#ID) is repeated numerous times! This obviously causes problems with generating records and forms concerning information for 1 particular primary key. Is there a way around this problem other than specifying search criteria down as much as possible?! Perhaps there is some SQL code.
View 1 Replies
View Related
Apr 2, 2014
I have an access table and I want the code that will check two columns in the table "EnvelopeType" and "EnvelopeSize" and create headers in Excelsheet automatically. In the attached workbook, like in sheet1 the headers are already appeared, I want this to be done dynamically using vba code so that if new values get inserted in EnvelopeType and EnvelopeSize then we won't have to change the code to display more headers.
Please see attached workbook named Sample and Access table. E.g.
EnvelopeType EnvelopeSize
TNT 2nd Class C5
PP1 2nd Class C5
PPI 1st Class A4
Recorded A4
TNT 2nd Class C5
PP1 2nd Class C5
Recorded A4
PPI 1st Class A4
Recorded C5
With the code it should display following headers in excel sheet:
TNT 2nd Class C5
PP1 2nd Class C5
PPI 1st Class A4
Recorded A4
Recorded C5
View 14 Replies
View Related
Jan 27, 2015
I'm having a little difficulty setting up a combo box to filter another combo box. I've actually got one working but the second one is giving me all sorts of errors. On the attached database, there's a form called frmAddNewRecord. At the top of the form there's a combo box which allows you to select a name and another combo box beside it which acts as a filter so only names from a certain section are shown (working fine).
The subform which is attached to this form and contains the training details, has another combo box which allows you to select a job...I've tried to add a combo box beside this to filter it but I can't get it to work.
View 5 Replies
View Related