I want to write a code that upon opening the report it looks at the sumofamount field and only shows me the records that the sum is greater than $50. It currently shows me all the records and it they are less than $50, it comes up as a negative. I only want to see the one which have amounts over $50. Would I write this in code and have an even procedure upon opening of the report? I should also add that I have the amounts listed out the bottom of the page, so I can't just go into the query and put >50.
Thanks.
="" & [first name] & ", for the month of " & Format([date],"mmmm") & " your DHL bill came to " & Format([sumofamount],"$#,##0.00") & ", the company allows you $50.00 per month, this leaves you with an overage of " & Format([overage],"$#,##0.00") & ". This amount will be deducted from future commissions. Below is an itemized list of your charges. If you have any questions, please contact me at extension 4491."
I'm trying to hash two scripts I've found into 1 functioning filter, however I'm still relatively new to vba and can't figure out how to get this working.
I'm trying to use Allen Browne's Search Criteria:
with another snippete of code I found here:
Code: 'Purpose: This module illustrates how to create a search form, _ where the user can enter as many or few criteria as they wish, _ and results are shown one per line.
[Code]....
It's the date part I'm having trouble with, the rest of the search criteria work fine without the date, but I can't get it working when I try to modify and merge the date sections of each code.
Also I'm using a listbox for the "Yesterday";"Last 4 days";"Last 9 days" and not a combo box.
How can I create a "Filter Button" on a form and filter my records? I create a textbox on a form and a filter button on the right. Then I click the filter futton, the filter function will search/match the content in the box through the datasheet. And then the results of the filtering will be pop up on the split form datasheet.
I have a simple bit of code below but I need something added. All the code is doing is opening a form and filtering on a combo box value. It opens all cases where the status is open but if there are no open cases it takes me to a new record, how do I get my code to recognise that there are no cases and display a message box for me instead and then close the form?
In my report I have a field called "Packages" and my subreport consists of a table, one of the columns is "Packages" so I want to use the value that I have in "Packages" to filter for only those items in the sub report.
How to open the regular filterdialog (with the checkboxen for the different values) in a report with VBA. With the regular filterdialog I mean the one you get when you select a column and then push the filterbutton.
I tried Link model "bank_pay" with the main_form << to add details of information >> by "pay_num" in main_form and "num" in "bank_pay" by filter >>
Code: Private Sub pay_type_AfterUpdate() Select Case pay_type Case Is = "1" DoCmd.OpenForm "bank_pay", acNormal, "", """[forms]![main_many_1]![main_many_sub]![pay_num]="" & [num]", , acNormal
we have gotten in to a routine of copying, pasting and bastardizing old databases instead of creating new ones from scratch - and we've had a problem recently where we've started off with one master database back in 2011, which has then been the base for practically every single major DB we've created ever since.So this month we've copied and pasted (again) and started adding new features to what's already there, and the thing has corrupted. I've copied and pasted the same version three times and added all the new bits, and the same thing has happened every time.
So this time I've copied and pasted and tried my best to clean up, get rid of the dead weight and (where necessary) create completely new objects, split into FE and BE versions etc, and I've reduced the overall weight of the DB by about 50%.Due to time constraints I now need to crack on and get this thing working again and, for the most part, it does - but now I'm having trouble carrying the filter over from the OnClick Event of a form button to the next form it's opening.
We're using the DB to record attendees at an Event we're running later in the year. This is the code that I'm running from the OnClick Event of the button on Form1:
Code: Private Sub btnBkg_Click() On Error GoTo Err_btnBkg_Click Dim stDocName, vFilt As String Dim vBkgRef As Long Dim vContactID As Long
[code]....
You can see I've tried to use vFilt instead of the actual code for frmBooking's Where Condition, but for some reason it does not carry over to the form whichever way I try - when I open the immediate window and type ?vFilt it returns a blank entry. Not sure how to show the 'Where Condition' in the Immediate Window?Before Update, Open and Activate of frmBooking, but I'm hoping that the problem lies with what I've posted up here, as I don't want to get into posting the frmBooking code...
It may be worth noting that the button resides in the Header of a continuous form, with conditional formatting that changes the button caption depending on whether there is a value in the BkgRef text box of the record that has the focus.
Private Sub btncard_Click() Dim stLinkCriteria As String DoCmd.RunCommand acCmdSaveRecord stLinkCriteria = "[jobref]=" & "'" & Me![jobref] & "'" DoCmd.Close DoCmd.OpenForm "k_job_card", , , stLinkCriteria End Sub
this button code opens the k_job_card form.
the form opens and says 'Record 1 of 1, (Filtered)
i have a control on the form that opens.. and i am simply trying to assign a default value to that control..
it is a textbox.. for my jobtype field (text datatype)..
is there any particular reason why i cannot assign a default value to a control if it has been placed on a form that has been opened using a form filter?
this is how the Form Data tab is set at the moment..
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
I'm trying to use a command button in a form to filter and open a report. I am able to get it to open the report, but I cannot get it to filter the report based on a combobox in the form. I've tried every combination of code I could think of and find. Here is what I currently have:
Code: Private Sub FilterReport_Click() DoCmd.OpenReport "Report", acViewReport, "First Name='" & Me.FName & "'" End Sub
Code: Option Compare Database Private Sub Report_Open(Cancel As Integer) Me.RecordSource = Me.FName End Sub
"FilterReport" = Form Button "Report" = Report "First Name" = Report Field "FName" = Form Combo Box
Hi, I have this table with job numbers stored by days of the week e.g. mon job, tue job, wed job etc. You can have the same job number everyday of the week or different ones. I have to get a report that shows JOB # ??? and all of the fields associated with it. I'm trying with a query, but can't get it! How can I accomplish this?
I have set a query to carry out a list of companies from a table based on two criteria. However, the same company could appear two times in the results .
Is there a way to requery results to filter records that appears two times and leave them only one time in the final list? Thanks in advance
i have a table with 20,000 records. one column includes names. another column includes multiple dates the person visited a doctor, and another column includes dates the person visited a hospital. i am only interested in the last date the person visited a doctor and the last date the person visited a hospital (if they had any visits to the doctor or hospital). I am also interested in members who have had no visits to the doctor or hospital. any suggestions on how i can filter the data to only return these records? thanks
Name Date Visited DoctorDate Visited Hospital Nigel01/01/1980012/31/1995 05/20/199906/06/2005 03//02/200405/06/2004
For example, I only want to return
Nigel, 03/02/2004 (Date Visited Doctor), and 06/06/2005 (Date Visited Hospital). thank you. i really appreciate any help you can offer.
setting up a database for my department at work and have a few questions
a.) i need to set my form to have a search or filter based on user criteria
1.) users need to be able to select themselves from a drop down list that's based on a table in order to filter their cases from everyone elses
2.) instead of using the drop down menu i'd like them to be able to enter an ID number that pulls up a specific record rather than first selecting all their cases and then navigating those until they come across the case they're looking for
In my database I want to create a report that identifies if some is available or not every day. I have a general table(Tbl_General) with names and contact info, in a second table(Tbl_Recall) I have 3 fields Location StartDate EndDate. I want to show every person from the general table and only records from the Recall table where the start date is before today and the end date is after today.
The queries I write exclude some records if I limit the dates and the reports I build show all records in the recall table.
In access, I have the following: 2 sub forms located in an overall form. I would like when I select a record in the first subform, that the second subform would automatically filter for all records that contain the same ID Value.
I have a bit of a problem with a database in Access 2013. On 1 of the forms, I have a number of buttons which open other forms and filter the results using an embedded macro. All has been well until a few days ago when error 2950 pop up box started appearing. After fiddling around for a while it all works OK (without actually changing anything) until next time the database is opened. I checked to make sure the location is "trusted" and all seems OK.
I am trying to build an expression in a query that will filter specific numbers when the value is entered. I would like the value box to read something like "Please enter the file number" and when entered, see example of file # in brackets (001-200-001), it will show those records with that file number only. In addition, because I will be printing it from a report, the filtered file numbers should also show up in the form.
I need to navigate through all records for a table where a <field> = a certain "string". Ideally I would have a next record button that would know to ignore records that do not meet my criteria?
Simply put, Next available record where <field> = "string"?
I use Access 2003 and saw Ken Higg's sample database to filter records in a form using a combobox. I managed to replicate his settings and wondered about an extension to the principle, but I don't know if it's possible.
In the sample, a value is selected using a combobox and all matching records are filtered so it's possible to scroll through them. Is it possible to have a second (or more) combobox on the form so it is possible to filter on one or another criterion? This would mean one combobox filling the other one and I realise that the one that Ken provided is unbound.
The reason that I'd like to do this is, for instance, if there are records with Surname, 1st, 2nd and 3rd lines of the Address and Postcode, I may wish to filter records by entering the Surname or Postcode. Each of these fields would have to be displayed in a combobox. As the sample is set up at present, only one of the Surname or Postcode has to be selected via the combobox and the other is a textbox.
It may be that what I'd like to do isn't possible - or someone may have come up with some other idea. I'd prefer to have the search/filtering on the form, rather than using the buttons on the Form View toolbar.
A form I created contains buttons for the user to restrict the display- showing records that are tasked to one specific employee. So their choices are Employee a, employee b or all employees. This is a process I use a lot :) This last form opens with NO records displayed. When a button is clicked the records show correctly. Any idea what to check? Thanks,
I am importing about 1.5 million records from a .txt file into an Access database. I have the code that splits the records and adds them to the database. However, the database has a 'specialty' table that lists certain specialty codes. The incoming record has a field that is a specialty code. Any way to search the 'specialty' table for the code that is coming in on the record to be added, and then, if the record 'code' is not found, skip it, and if it is found, add it to the database. There are about 70 codes in the 'specialty' table.