Randomizing Based On Criteria
Dec 17, 2013
I have created a db where I need to run a report based on randomizing. Basically there is a table ORDERS that is updated daily with orders from clients.
Table structure is:
ORDER ID (autonumber).
CLIENT.
ORDER.
Quantity,
Date.
Sampling criteria is:
if number of Orders is from:
1-10 show me 90% of them
11-20 show me 85 % of them
21-100 show me 51% of them etc
I did found this code for the randomizing with autonumber:
Private Sub cmdSelect_Click()
Dim SQL As String
Dim sWhere As String
Dim iCount As Integer
Dim i As Integer
Dim j As Integer
Dim iSelectHowMany As Integer
[Code] ...
How to integrate into this code my sampling?
View Replies
ADVERTISEMENT
Feb 9, 2008
Hi. This is my first post.I just recently started using MS Access.I have a table with 40 records, and would like them to change their order in a random way, every time the database is opened.Is there a way to do this?Maybe with a macro or module in autoexec?Thanks in advance.LF
View 3 Replies
View Related
Mar 20, 2013
I have a report that gets its data from a query. I need the query to run before the report based on criteria based from two combo boxes on a form.
View 3 Replies
View Related
Aug 18, 2005
I have table with filed with jobs that our IT’s have done for that day, the table is updated daily, based on my table I have created my query, I have set some criteria for some fields though, as follow:
Month = [Forms]![DailyWorkForm]![commonth]
Year = [Forms]![DailyWorkForm]![comyear]
ITName = [Forms]![DailyWorkForm]![comit]
Day = [Forms]![DailyWorkForm]![comday]
on my form I have commonth, comyear, comit, comday and a command button that will open a report based on the query which will be based on my 4 combo boxes on my form, ok I hope I didn’t make you all really confused, this is the question what if the user inputs on 2 combo only, meaning that if month = may and year = 2005 and left ITname and day empty, I still want the query to run, how can I do that?
Thanks a lot.
View 8 Replies
View Related
Feb 15, 2006
Hey guys, apologies in advance for a question which you may have answered many times, I have searched the net, my textbook and these forums but to no avail.
I have a table, 'tblStock'.
I have two fields within this table, 'Stock Level' and 'Minimum Stock'.
I want to run a query on this table, finding all records where the value in 'Stock Level' is LOWER than the value in 'Minimum Stock'.
How would I go about setting up this query? What criteria would I type? I have tried typing <"Minimum Stock" in the criteria for 'Stock Level' but it didn't work.
Thanks in advance... this will be a big help. :)
View 7 Replies
View Related
May 2, 2014
I have a table where the columns are team1, team2 and winner. Team1 and team2 are comboboxes that show all the teams in Team table. After I pick the team1 and team2 in a row I want to make a listbox that shows only those two teams as options for the winner.
View 3 Replies
View Related
Apr 3, 2012
I have a query in Access with the following fields (grouped):
"Name" "Facility" "Number of Visits"
I want to limit the query to only pull those names that have at least one visit to a specific facility (let's say facility "A"), but I also need to see all of the other facilities that those who visited Facility A visited. So in this case "= "A"" in the criteria section of the Facility field wouldn't work. I think I need to plug something in the criteria section under the Name field, but I am not sure what.
View 1 Replies
View Related
May 9, 2007
My database tracks individuals qualifications. These qualifying scores relate to Unqualified, Expert, Advanced etc. What I want to do is add a entry into my roster table which will have the qualification score.
I then want to have the score and actual qualification (Advanced, Expert, etc) in a Report.
The qualification type is a range (less then 30, 31-40, 41-50), and I think that I will need a BETWEEN statement. What I am not sure of is how to put this together to make it equate the number with the equivalent word in a report.
Thanks
the brewmeister
View 3 Replies
View Related
Apr 28, 2005
I've got a database that pulls from a table. One of the options on the table is pending or complete. Right now, there are over 1000 records because they are all stored in the same record. I'd like to move the completed items to a different table.
Can this be done? If so, what steps do I need to take to do this?
Thanks!
View 3 Replies
View Related
Aug 21, 2005
Hi all,
I am endeavouring to filter a form based on the position of an individual.
I would like the users to be able to select their position and then any record where there is a match in the "Primary Responsibility" field or the "Secondary Responsibility " field will be displayed.
I have an underlying query that is populated by a combo box on an unbound form.
This has worked when generating reports for individuals but I cannot get the required result when using the form.
Thanking anyone in advance who can assist me with this.
Regards,
Rod
View 2 Replies
View Related
Mar 25, 2006
I am not sure if this possible, the methods I have looked up on the Internet take ages for the query to open but I'll give it a shot.
What I need to do is count (and increment) how many records are returned in a query for each person.
So if 1 person returns 4 unique records, in these records it shows 1,2,3,4 in each record.
The way i have tried is by using DLookup to check the next record and evaluate it using IIF but this takes about 25 seconds to return circa 50 records.
View 5 Replies
View Related
Sep 20, 2006
I have a query that is set up to join two name fields...for example:
[ELIGVENDORS.LSTNAM] & [ELIGVENDORS.FSTNAM]
The issue is that this is perfect for names that are entered in the table like this:
Lstnam: ABC HOSP Fstnam: ITAL
They are entered like that for groups, but when individual doctors are entered, the data entry folks are entering them like this:
Lstnam: SMITH Fstnam: BOB Titlcd: MD
So when I join them the first displays correctly as ABC HOSPITAL, the second displays as SMITHBOBMD and I have to manually go in and add a comma.
Is there a way to do an if/then statement or something to tell the query to display results If the titlecd is NOT NULL, display as [ELIGVENDORS.FSTNAM] & [ELIGVENDORS.LSTNAM]&", "&[ELIGVENDORS.TITLCD], else display as [ELIGVENDORS.LSTNAM] & [ELIGVENDORS.FSTNAM]
I'm sure there is, I am new to IF/THEN statments though and was hoping to get some help setting it up.
Thanks in advance and I hope my description is clear enough.
Han
View 2 Replies
View Related
Nov 6, 2006
Is there a way in a query (using SQL) to go to the first record to update a field based on a criteria ?
For example if my amount field shows two amounts for $300.00 I want to go to the first record that has $300.00 to update a field in that record.
Is that possible?
View 9 Replies
View Related
May 8, 2007
Hi all,
Very very new to Access, moved department a week ago and inherited a couple of databases that need tweaking. Although I'm learning I am stuck by something very simple and can't find it by searching this forum or Google :)
I have a query that originates from 2 tables, there is one custom record made from 2 of the fields -
Free Stock: [stk_stkqty]-[stk_allstk]
Now I want a record that shows -
Product where the free stock = backorder stock
so theroetically my guess as a beginner is -
SELECT * FROM [Product] WHERE [Free Stock] <> [Back Order]
But it fails miserably on syntax. Can someone point me in the right direction, and I apologise for my lack of understanding in advance.
Boofuls :)
View 5 Replies
View Related
Jun 1, 2007
Hi,
I am building a database that calculates freight costs for shipments.
I have one table that has order data with fields such as [Order Number], [Origin], [Destination], [Service Level], [Weight].
The service level is one of 4 values: PRE 9, PRE 12, NEXT DAY, NEXT DAY +1.
The origin and destination use country codes such as BE, AT, CZ, PL for Belgium, Austria, Czech, and Poland respectively.
I also have rate sheets from carriers such as DHL and UPS and they provide their rates in the following format (numbers are made-up as real rates are confidential): [Origin], [Destination], [Service Level], [0 to 0.5 kg], [0.5 to 1.0kg], [1.0 to 1.5kg], [1.5 to 2.0kg], etc all the way up to 30kg. The rate is then in the appropriate column and the row gives the origin-destination-service level combination.
(sample freight rate table uploaded as zipped excel sheet in attachment)
I need to return the rate from the appropriate row based on the [Origin], [Destination] and [Service Level] fields (easy enough), which is easy enough.
The hard part is selecting the correct field to return. I tried usign a Choose expression but Access rejected it saying it was too complex (maybe because too many choices?).
So I'm stuck. And working towards a deadline... :-)
Can anyone help please?
Many thanks,
Martin.
View 1 Replies
View Related
Sep 7, 2007
Hi All
I want to create a query which is based on two fields.
One field is a date query i.e >=Date()-7 OR >=Date+7
The Other is a Combo box where the criteria is No
My problem is that access is currently running this as two individual queries.
Is it possible to make this query return data only when both fields are matching?
Or do I have to run this as a parameter query?
Thanks!!
View 2 Replies
View Related
Feb 23, 2005
Hi,
I have a form (say Form X) that opens based on the ProjectID criteria in the query, which is based on a record selected from Form1 [ProjectID].
I want to be able to open Form X using information from 2 forms - Form1 or Form2, both using ProjectID. What I've done so far works, but I get an Enter Value Parameter looking for the other Form. How do I write the statement so that it reads Form1 [ProjectID] and if that is not open (null??), then it goes to Form2 [ProjectID] and vice versa?
What I have is:
IIf(("IsNull[Forms]![FrmAddPrjInfo]![ProjectID]"),[Forms]![FrmPrjRvwerMgrDue]![ProjectID],0) Or IIf(("IsNull[Forms]![FrmPrjRvwerMgrDue]![ProjectID]"),[Forms]![FrmAddPrjInfo]![ProjectID],0)
Variations of this haven't worked. Perhaps IIF statement is the wrong way to go about this?
Any suggestions? Thanks!
View 5 Replies
View Related
Feb 12, 2006
Hello everyone,
I have a problem with opening forms.I have situation with 8 forms (small ones!) which must be open based on values in ComboBox1 and ComboBox2.
Can I do it with Select case (DoubleClick event), and how?
THANK YOU IN ADVANCE,
View 4 Replies
View Related
May 30, 2006
Hi there i am building a search form and I want it to be able to display results from multiple criteria......Currently I am able to display results in a listbox, whenever the user types in a id number in a text box. So if a user types 63 in the ID text box the record with and ID of 63 will appear in the list box or it will wont if the record does not exist..... What i want to do is be able to search on multiple criteria. Sof if a user wants to search based on a name instead of a id number they woudl be able to. What I am struggling to grasp is how to invoke a OR in the criteria box. So that the list box will display results based on either the ID text box OR the name text box.
Any thoughts?
View 1 Replies
View Related
Dec 5, 2004
Hi,
This is my first question... please guide me
I have two tables say Daily and Master, and now I want to
update the Daily table and add two additional fields in this table
based on the data from the Master table.
Please suggest me..
View 10 Replies
View Related
Apr 30, 2007
This is in regards to my same database file posted in my last thread. Basicly it's a work order database. Each task has an employee and the quality of work they did. 1=Bad, 5=Great...so it's from 1-5. I need to create a report of all the tasks which had a quality score of 3 or below for the previous month. I'm good with SQL, but I can't figure out how these Access reports work.
I want my client to be able to double click on the report and have it generate. It would be nice to have it save to a PDF or Word doc, but that would be a plus. Right now I just need to know how to generate reports based on a criteria. I searched the web for 2 hours and could not find anything about this.
Thanks
View 2 Replies
View Related
Aug 12, 2013
I have table.[reconciled] tat allows for a check box. i want to enter in the criteria filed in query design that i only want to see the unchecked or false entries. i have tried writing the criteria multiple ways and i cannot get it to filter out on my sub form query.
SELECT FuelmanImport_tbl.Reconciled, [Driver PIN].Division, [Driver PIN].[Transportation Supervisor],
FuelmanImport_tbl.[Transaction Date], FuelmanImport_tbl.[Card Number], [Driver PIN].Driver,
FuelmanImport_tbl.[Cardholder Name], FuelmanImport_tbl.[Prompted ID], FuelmanImport_tbl.[MCC Description],
FuelmanImport_tbl.[Merchant Name], FuelmanImport_tbl.[Merchant Address], FuelmanImport_tbl.[Merchant City],
[Code] ....
View 14 Replies
View Related
Aug 5, 2015
I am having trouble filtering my report. My goal is to filter the report by:
1) [DateChanged] by user entry on a form (txtFrom and txtTo)
2)[Deliverable] by selection of a list box on form
My error is in the last line when i open the report. It only lets me filter using either option 1 or 2. When I include the "And", it gives me the error "Type Mismatch". I know its a syntax error.
My code is below
'''''''''''''''''''''''''''''''''''''''''''''''''' '''
Dim Deliverable As String
Dim DateChanged As String
Dim VarItm As Variant
For Each VarItm In List2.ItemsSelected
Deliverable = Deliverable & "[ID] = " & List2.Column(0, VarItm) & " OR "
[Code] .....
View 3 Replies
View Related
Sep 15, 2005
Maybe it's the day's 'brain drain', but I need to set a criteria in a query whereby it will select answers in a field that are a specific number of characters in length.
i.e., answers that are 5 digits long (without knowing any of the digits)
Russ
View 2 Replies
View Related
Sep 26, 2005
Dear all,
I would like to seek your help on this problem.
I would like to do a search for my records based on 2 different criterias. If found, the function should just return a boolean value so that I can act further based on the boolean value.
The reason I'm doing this is that I have 2 similar tables that contains EventID and AttendeeID and these 2 tables cannot have the same EventID and AttendeeID. So before I can allow a record to be inserted in the 1st table, it must check that there is no record in the 2nd table that has the same EventID and AttendeID. If there is, then i cannot allow the record to be inserted in the 1st table.
The same thing applies when I want to insert a record in the 2nd table. It must now check the first table.
Recordset.find seems to be only catering to 1 criteria, not 2.
Pls help. Codes are most welcome too.
View 3 Replies
View Related
Aug 16, 2005
I have a table that stores records by "return date". I would like to create a delete query that removes all records that fall outside of the date range entered on a specific form (frmMainMenu).
I can deleted the records that match the form criteria, however that is not what I need. The criteria used to delete the records was:
Between [Forms]![frmMainMenu]![from date] And [Forms]![frmMainMenu]![to date]
Let's say that the frmMainMenu contain the date range of 8/1/05 to 8/10/05, however the table contained data from 6/1/05-8/14/05, I would like for the query to delete all records that have a date 6/1/05-07/31/05 and 08/11/05-08/14/05.
Any assistance would be greatly appreciated. Thanks in advance for your help![/SIZE]
View 1 Replies
View Related