Advertisement

07.20.2007 at 08:55PM PDT, ID: 22711195
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.6

INSERT Statement using VBA in Access Database

Asked by mickygene in Access Coding/Macros, Microsoft Access Database

Tags: , , , ,

I am trying to insert a bunch of dummy records into an Access Database table using VBA in a module called survey_results. Below is the code I am using. I'm getting the infamous Object variable or With block variable not set (Error 91). I have Access 2003 using windows xp.

Public Sub build_survey()


'Option Compare Database
Dim random_number As Integer
Dim dbs As DAO.Database
Dim upperbound As Integer
Dim lowerbound As Integer
Dim i As Integer
Dim j As Integer
Dim k as Integer

lowerbound = 1
upperbound = 5

For i = 1 To 666 'Number of Classes
    For j = 1 To 500 'Number of Students answering the survey
        For k = 1 To 10 'Number of Question
             'random_number = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
             random_number = Int((5 * Rnd) + 1) 'Values can be from 1 to 5
            dbs.Execute "INSERT INTO survey_results (class_id, student_id, question_id, value_id) VALUES (i,j,k,random_number)"
     

        Next
    Next
Next
End Sub
Start Free Trial
 
Loading Advertisement...
 
[+][-]07.20.2007 at 08:57PM PDT, ID: 19537164

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Access Coding/Macros, Microsoft Access Database
Tags: insert, vba, access, statement, using
Sign Up Now!
Solution Provided By: mbizup
Participating Experts: 5
Solution Grade: A
 
 
[+][-]07.20.2007 at 08:59PM PDT, ID: 19537167

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.20.2007 at 09:00PM PDT, ID: 19537169

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.20.2007 at 10:32PM PDT, ID: 19537299

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.21.2007 at 03:20AM PDT, ID: 19537974

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.21.2007 at 05:06AM PDT, ID: 19538226

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.21.2007 at 09:53AM PDT, ID: 19539916

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32