I have a small unbound form which has a txt box with code something like =Rnd((20-1+1)*Rnd()+1)) to generate random numbers. When the db and form are first opened the field always contains the same number. Using F9 to refresh will generate another number but it is always the same too.
If the form is closed then reopened (db is not closed) the field will happily generate a random number each time the form is opened or if F9 is used.
I have tried Recalc in numerous events but each time it failed to work. It's late at night here so I'm hoping the morning will bring a clearer outlook???
Was playing around, and when using the Code:Me.txtNum1.Value = Int((51 - 1 + 1) * Rnd + 1) format, I noticed that, with 6 differnet text boxes, that after opening the database, the "random" numbers repeat in the same order. That is, with 6 randomly generated numbers, the first set is always the same and the second the same and so on.
Can you please help me out--give me some guidance-if you have knowledge about random numbers. Say, for instance, I have 2,000 records and I want to randomly create a final list with 800 of these records, how do I go about it? Thanks.
Hi, I have a DB that is basically a big electronic form. Each table is a section of the form and the main central table stores the ID's from the other tables. Most of the relationships are one to one but without referential integrity because sometimes sections need to be skipped.
It's been growing fairly rapidly lately as bit's keep getting added but now a weird deletion problem has started appearing. Every once in a while when a user goes to complete the form (right at the end) it suddenly dissapears. The records in the related "section" tables are still there but the main table storing all the ID's loses the record.
There are NO cascade update/delete's on any of the relationships, also no-error message appears it just goes. I think there is a problem in actually saving the record because I moved a DoCmd.RunCommand acSaveRec command from the complete button to a slightly earlier process and the point at which the record dissapeared also moved.
Does anyone know what may be causing it? It only happens to about 1 in 30 forms and there is no obvious link between the problem and a) the machine it happens on b) the person using it c) the data entered into the form
If it happens the same user can input exactly the same data in exactly the same way and it saves it fine.
It really is random!
People are starting to get really frustrated. I was tring to "sell" the idea to a new department as well and had 15 people sitting in front of a projector when it happened to me. I was mortified :eek:
this was working fine but now i get the following error message:
Run-time error '40036' Method 'Item' of object 'Forms' failed
when i debug, it highlights the line Forms![Payment Numbers]![VerificationID].Value = ANumber
the purpose is to get the LastOfVerificationID value from form 1 and then open Payment Numbers, create a new payment number, set verificationID to the new value. this was working fine and without even woring on the forms code, this error has arisen.
With Access 2003 I have a tbl_Orders with the field OrderID set as Autonumber>Long Integer>Random. This produces long strings of numbers both positive and minus. Is it possible to set a certain format such as #### and no less than 0 but no more than 9,999?
i have a query which returns n number of rows. my problem is that i need to display the values in text box which is created automatically according to the number of rows returned in the same page(form).
for example if my query returns 1 row then 1 text box must be automatically created and then the value must be displayed and if my query returns 3 rows then 3 text boxes must be created and then the corresponding three values must be displayed.(on the same page).
Quick question, how do I have access generate a random number between 1 and 8? I want it to generate either a 1,2,3,4,5,6,7, or 8. (no zero, no nine)
Expr1: Fix(Rnd(8-1)*10*Rnd()) is what I have been using, but this always generates the number 2? I do want the decimals to be rounded to the nearest integer, thus I have Fix.
If someone could please help me, it would be greatly appreciated! Thanks in advance.
First of all there is a table called "tblParTeam" wich contain the teamname and ID of teams partissepating in a certain Tournament. The tournemant data is kept in the table tblTournament.
Each tournament contains a couple of variables: "Number of teams per tournament", "Number of Rounds" wich reside in the tblTournament.
Here is the thing. I also have a form based on the tblTournament. Each tournament had a number of partisipating teams (stored in the variable "Number of teams per tournament"). Then I have a table called tblTournamentDetail wich containt the Tournament_ID, TeamPro_ID (looks in the table "tblParTeam"), TeamContra (also looks in "tblParTeam").
When I pusch a button on my form, wich is based on the tblTournament, tblParTeams and tblTournamentDetail, I would like the X (Number) of particepating teams to be filled in randomly in the tblTournamentDetail.
Lets say I have 10 teams I want 5 to be filled in randomly in the TeamPro_ID and 5 in the TeamContra_ID. How do I go about this?
I hope someone can help with this. I have a table, "Blasthole Submission" which is populated by input in a form, using the code below:
Const MyTable As String = "Blasthole Submission" Const MyField As String = "Sample Name" Dim db As DAO.Database Dim rs As DAO.Recordset Dim intCounter As Double Set db = CurrentDb Set rs = db.OpenRecordset(MyTable) For intCounter = Me.txtStartValue To Me.txtEndValue rs.AddNew rs.Fields(MyField) = "TP" & intCounter rs.Fields("Submission #") = Me.SubNum rs.Fields("Sample Type") = "Blasthole" rs.Fields("XRF") = "True" rs.Fields("LOI") = "True" rs.Update Next intCounter rs.Close db.Close Set rs = Nothing Set db = Nothing
What I am hoping to do is to place a random duplicate in the table, called, for example TP111152 DUP, approximately every 50th record. Is there any easy way of doing this?
In my table design view I've set my primary key to auto number and the 'New Values' to random. The problem is, sometimes the numbers generated are too long or negitive. Is there any way I can specify the limit of the numbers to be generated and keep them positive numbers?
this is my first post, so i hope i'm in the right bullettin.
I need help with this problem:
I have to work on this mdb that has been imported from Access 2000 to Access 2003. The guys did it some months ago, and of course they deleted the old .mdb and there are no backups. However, the db still works, except that the ID of some tables are now "random id" than "incremental id", and since they used it for some months, now they are full of new records with random IDs. Since they use THAT id for internal use, you understand that is not very easy to communicate stuff like "please send me document # -3189175187" and so they asked me to get it back to incremental, i tried from the table menu to change the dropdown, as i thought it was that easy. Bad luck, access now complains that the data aren't now contiguous (might be different error, it's a localized version, so i don't know how it is the exact error message, sorry), and i'm not really sure on what to do to avoid problems.
I've explained the best way i could, so if you need more info just ask, thanks everyone in advance!
I am not real sure whether or not this can be done with a query, but here goes. I have a query randomly selecting the top 6 from a selected group.
SELECT TOP 6 tblConsortium.ContactID, tblConsortium.RandomID, patients.LastName & ", " & Patients.Firstname AS [Employee Name], Contacts.Company AS [Company Name] FROM patients INNER JOIN (Contacts INNER JOIN tblConsortium ON Contacts.ContactID=tblConsortium.ContactID) ON patients.PatientID=tblConsortium.PatientID WHERE (((tblConsortium.ContactID) In (SELECT ContactID FROM tblConsortium GROUP BY ContactID HAVING Count(*) <25))) And (((tblConsortium.PatientID)=Randomizer())=0) ORDER BY Rnd(IsNull(tblConsortium.patientID)*0+1);
What I would like to do now is: The randomly selected Employees need to have a randomly selected TEST. There are only 3-Test to choose from. I have placed the TESTS in a separate table and entered 20 of TEST1, 4 of TEST2, and 1 of TEST3. I then set a query randomly shuffling these items. I need these TESTS to randomly be assigned to the randomly selected Employees above.
I would greatly appreciate any thoughts or help… Thanks Enviva
I have this query: SELECT UNIT.Code, Rnd() AS Expr1 FROM UNIT;
The problem is that in the Expr1 field all the numbers are the same. I would like to have random numbers that are different for each record (generate new random number for each record)
If i have a table with several records let's say 1000 records, and each record has a field called cboCategory. Now from these 1000 records, lets say i have 200 records which has a value of CategoryA in the cboCategory field. Now is it possible that i extract "randomly" a number of records from that particular category chosen.
e.g.
Table -> 1000 records
records which belong to categoryA -> 200
extract 20 random records from the table which have a value of categoryA inthe cboCategory field.
I'm new to this so here goes...I've got an Access query that I'm trying to remove the first 5 characters from the 10 character name in each record. The name is composed of both letters and numbers. The first 5 characters vary but it is always the first 5 that need to go.
I am a student (studying Sound and Audio) and will soon be running some listening experiments as part of my course. In this, the listeners listen to 1 of a selection of pieces of audio (possibly 4 in total) and answer questions about it. As I now have some experience in Access it seemed the ideal choice to create the software for these tests (I don't know any other programming languages anyway!). So I've recently got to grips with Windows Media Player ActiveX control so all is going good. Herein lies my problem...
The order that the audio is played in (from listenener to listener) needs to be random to prevent any possible biasing effects resulting from ordering. However, I need to ensure that each excerpt gets an equal number of playings, or that this is kept within tight constraints hence using a standard Random Number generator is not ideal. Ideally, if I had four excerpts I would like it if every four occurences each excerpt occurs once.
I can visualize the process in my head I think (it's not complicated) but I have no idea where to begin programming this.
Thus far my idea is that when the form/software opens it generates said number; each number is associated with an excerpt and a Select Case clause opens that audio file in the WMP ActiveX control. When the user is finished the form would eventually refresh for new data and when it gets there a new number is generated (fitting the above constraints). The form would be bound to the main data table so I can collect responses to questions on the same form.
So... any ideas on how to generate this number? I have searched extensively on this forum and the web but no threads seem to offer quite what I'm after.
Ok, I apologize in advance for my lack of knowledge but I need Help!!
I have a database form that has a O_Num field that populates the Order table. Now the client wants the order number to be a randomly generated number. this is the primary key and I cant use autonum because there is another field in the table that is autonum.
I have tried to use the following in the OnClick field, doesnt work
Hello i've got to make a project for school and thought I would make a rental shop like Blockbuster. But I need to create a number that will be assigned to each customer when they become a member. So I need to generate a random number that uses a certain amount of digits (I was thinking about 8) and that won't be used again can you help.