473,385 Members | 1,983 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Using VB in Access to shuffle a record set then copy it over to another..

Here is my prediciment. I have a database with a form. It in the people can pick a main category, then sub category, then it shows a list of questions from that in a sub form. I am trying to find a way to shuffle the questions in the sub form whenever they rechose a new sub category

[Main Category]
[Sub Category]

[SubForm with questions from sub category]



I was trying to change a shuffle script that I have used before to work here but have spent 3 hours and came up blank..

Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo30_AfterUpdate()
  2. Dim MyDB As Database, MyRS As Recordset, intNoOfRecords As Integer
  3. Dim intRandomRecordNumber
  4. Set MyDB = CurrentDb
  5. Set MyRS = MyDB.OpenRecordset("Questions", dbOpenDynaset)
  6. MyRS.MoveLast
  7. intNoOfRecords = MyRS.RecordCount
  8. intRandomRecordNumber = Int(Rnd * intNoOfRecords)
  9. MyRS.AbsolutePosition = intRandomRecordNumber
  10.  
  11. ' Dim rs As Object
  12. 'Set rs = Me.Recordset.Clone
  13. 'myRS.MoveFirst
  14. 'RS.MoveFirst
  15. 'Do Until MyRS.EOF
  16. 'rs.Edit
  17. 'rs.Fields("Question") = MyRS.Fields("Question")
  18. 'rs.Fields("Answer1") = MyRS.Fields("Answer1")
  19. 'rs.Fields("Answer2") = MyRS.Fields("Answer2")
  20. 'rs.Fields("Answer3") = MyRS.Fields("Answer3")
  21. 'rs.Fields("Topic") = MyRS.Fields("Topic")
  22. 'rs.Fields("Section") = MyRS.Fields("Section")
  23. 'rs.Update
  24. 'rs.MoveNext
  25. 'MyRS.MoveNext
  26. 'Loop
  27.  
  28.  
  29.  rs.FindFirst "[Topic] = '" & Me![Combo30] & "'"
  30.  If Not rs.EOF Then Me.Bookmark = rs.Bookmark

The first part is the shuffling of the questions.....the second part I was trying to figure out how to copy the contents of MyRS which is shuffled over RS. The last part just displays what is selected....Maybe I am TOTALLY off here. Any help would be great
May 3 '07 #1
0 1237

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Scott McDaniel | last post by:
I have a VB app which stores information in an Access 2000 db. The VB app handles multiple users (it's a logbook type of application, users share lookup tables but don't share information among...
5
by: Iain Miller | last post by:
Trying to get my head round building a DB to analyse phone bills. On the surface its fairly simple - duration in seconds x cost per minute/60. The problem arises with working out what time of...
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
5
by: stupi | last post by:
I have an access database replicated over a network. Recently and more often, after I fill one record into the database, and then try to replicate it, I get this message "scaling of decimal values...
6
by: Bob Alston | last post by:
I am looking for others who have built systems to scan documents, index them and then make them accessible from an Access database. My environment is a nonprofit with about 20-25 case workers who...
1
by: CapMaster | last post by:
I've found some programs of how to create a standard game of blackjack on C++. But how would you do it using structs? Here is my assignment: Problem Statement: The purpose of this project is to...
1
by: RobAMacAF | last post by:
Here is my prediciment. I have a database with a form. It in the people can pick a main category, then sub category, then it shows a list of questions from that in a sub form. I am trying to find a...
4
by: lupo666 | last post by:
Hi everybody, this time I have three problems driving me nuts :-((( (1) I have a report with 20 or so Yes/No "squares". Is there a way to either hide/show the "square" or change the yes/no...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.