Random Error
Feb 11, 2008
Hi,
everything was going fine until a random error appeared and now wont go away.
here is my code
MainFormPay()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = " Payment Numbers" ' name of form t open
ANumber = [LastOfVerificationID].Value ' set value of latest Verify number
stLinkCriteria = "[ContractorID]=" & me.ContractorID ' filter to contractorID
DoCmd.OpenForm stDocName, , , stLinkCriteria
Docmd.GoToRecord, , acNewRec
Forms![Payment Numbers]![VerificationID].Value = ANumber
end sub
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.
how can i fix it?
Nigel
View Replies
ADVERTISEMENT
Aug 10, 2005
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???
Has anyone got any suggestions? :confused:
View 10 Replies
View Related
Jan 5, 2005
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.
Why is it not really random?
View 1 Replies
View Related
Aug 30, 2005
Hi,
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.
View 2 Replies
View Related
Oct 4, 2005
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:
Any ideas would be greatly appreciated.
thanks,
Tom
View 4 Replies
View Related
Jul 27, 2007
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?
View 3 Replies
View Related
May 1, 2006
hi everyone,
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).
is this possible?
aravind.s
View 3 Replies
View Related
Jan 18, 2006
I'm looking for a way to generate a random list of 25 case numbers from a table which contains 500case numbers. Can someone tell me how to do this.
View 1 Replies
View Related
Jul 8, 2006
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.
View 3 Replies
View Related
Apr 7, 2008
Hello,
I have a very complex issue.
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?
Thanks in advance.
View 12 Replies
View Related
Jun 20, 2005
I need to select 200 random customers from my table, how can I do that?
Table: tblCustomers
PK: CustID
View 1 Replies
View Related
Feb 11, 2006
How can I make random auto numbers 8 digits in length (including leading zeros) and always positive?
Thank you
View 2 Replies
View Related
Feb 20, 2006
Hi Guys,
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?
Thanks in advance for your help!
View 11 Replies
View Related
Dec 18, 2006
Hi all
I would like to find out if there is a program where you can randomly select data out of a table?
I sit with a table with 17000 SKU's(codes and data) and need to randomly select items out of it for Stock Count's:confused:
Thanx:rolleyes:
View 6 Replies
View Related
Apr 26, 2007
Hi Guys,
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?
View 3 Replies
View Related
Jan 21, 2008
Hello all
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!
View 1 Replies
View Related
Sep 27, 2005
Hi all,
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
View 1 Replies
View Related
Jan 30, 2006
Hi,
Can someone please help. I am required to bring back a ranadom 10% of data where the [Total_Cost] field is less than £500.
Can this be done in one query? I have to use Access97 becuase this is the lowest Office Version we support.
:confused: .
View 1 Replies
View Related
Jul 25, 2006
This is my first post. Please help me.
Here's my DB :
Status : Number (Long Integer)
Random : Number (Double)
If Random value is around 0-0.9, the status value is 1
If Random value is around 0.9-1, the status value is 0
Here's my Query :
UPDATE DB Set Random = RND()
Rnd() give random value, but each records have the same value,
let's say 0.71212154
How can I update all records with random value,
with a single query ?
View 4 Replies
View Related
Sep 25, 2006
Hello,
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)
Thanks for your help
Cheers
View 2 Replies
View Related
Nov 3, 2006
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.
Thanks for any suggestion.
View 5 Replies
View Related
Dec 12, 2007
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.
Thanks in advance!
View 4 Replies
View Related
Feb 8, 2006
Hi All,
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.
Thanks a lot in advance (hope that makes sense!),
Bobadopolis
View 4 Replies
View Related
Feb 13, 2006
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
=Int((1000 * Rnd()) + 1)
View 1 Replies
View Related
Mar 5, 2005
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.
rn2j
View 2 Replies
View Related
Feb 27, 2012
I have below statement that select row from my table at random.
Code:
sql = "SELECT TOP 1 * FROM Question1to5table ORDER BY Rnd(-10000000*TimeValue(Now())*[id])"
How do make the row selection unique.
:::: maybe mark a selected row on the dataset, if possible how do i do that ::::
View 7 Replies
View Related