Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 587701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:14:24+00:00 2026-05-13T15:14:24+00:00

i’ve been trying to create a vb6 code that will randomize 10 questions but

  • 0

i’ve been trying to create a vb6 code that will randomize 10 questions but it’s not working. i use sql as my database

here’s my code:

Private Sub cmdNext_Click()
Dim real_ans As String
Dim nCnt As Integer
'nCnt = nCnt + 2
'Label3.Caption = nCnt
real_ans = Adodc1.Recordset.Fields("answer")
 With Adodc2.Recordset
 Dim grade As String

If (real_ans = "A" And Option1.Value = True) Or (real_ans = "B" And Option2.Value = True) Or (real_ans = "C" And Option3.Value = True) Or (real_ans = "D" And Option4.Value = True) Then
    .Fields("english_score").Value = .Fields("english_score").Value + 1
     nEnglish_score = Adodc2.Recordset.Fields("english_score").Value
     Select Case nEnglish_score
Case Is >= 7 'If score above 80...
    grade = "genius" 'Give an A
    With Adodc2.Recordset
    .Fields("IQ").Value = grade
    End With
Case Is >= 6 'If score above 70...
    grade = "Superior " 'Give a B
     With Adodc2.Recordset
    .Fields("IQ").Value = grade
    End With
Case Is >= 5 'If score above 60...
    grade = "High Average" 'Give a C
     With Adodc2.Recordset
    .Fields("IQ").Value = grade
    End With
Case Is >= 4 'If score above 50...
    grade = "Average" 'Give a D
     With Adodc2.Recordset
    .Fields("IQ").Value = grade
    End With
Case Is >= 3 'If score above 40...
    grade = "Low Average " 'Give a E
     With Adodc2.Recordset
    .Fields("IQ").Value = grade
    End With
Case Is >= 2 'If score above 30...
    grade = "Moron" 'Give a F
     With Adodc2.Recordset
    .Fields("IQ").Value = grade
    End With
Case Is >= 1 'If score above 20...
    grade = "Idiot " 'Give a G
     With Adodc2.Recordset
    .Fields("IQ").Value = grade
    End With
Case Else 'Else
    grade = "xxxx" 'Give a G
     With Adodc2.Recordset
    .Fields("IQ").Value = grade
     .Update
    End With
End Select

     End If
    Adodc1.Recordset.MoveNext
    End With



End Sub

Private Sub Command1_Click()
frmExam2.Show
frmExam2.SetFocus
End Sub

Private Sub Form_Initialize()
Command1.Enabled = False
With Adodc2.Recordset
.AddNew
.Fields("name").Value = cStudent_Name
.Fields("section").Value = cStudent_Section
.Fields("english_score").Value = "0"
.Fields("math_score").Value = "0"
.Fields("abstract").Value = "0"
.Fields("total_average").Value = "0"
.Fields("IQ").Value = "0"
.Update
End With
End Sub

Private Sub Text1_Change()
If Text1.Text <> "" Then
cmdNext.Enabled = True
Else
Command1.Enabled = True
 cmdNext.Enabled = False
End If
End Sub

Please help me i cant figure out whats wrong.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T15:14:25+00:00Added an answer on May 13, 2026 at 3:14 pm

    yep what’s the error message?

    1. you don’t save any space with this ‘with’:
    With Adodc2.Recordset
        .Fields("IQ").Value = grade
    End With
    
    1. you can remove that block of code to the end (after End Select), since its in every Case statement anyway.
      So compress it down to:
    Adodc2.Recordset.Fields("IQ").Value = grade
    
    1. why not have your option values and answers stored in the same way so you can just do a single comparison, like:
      if real_ans = OptionValue then …

    for random numbers, try this:

    Function Rand(max As Long, Optional Min As Long) As Long
    
            Dim s As Single
            s = Rnd(1) * (max - Min + 1) + Min - 0.5
            Rand = CLng(Round(s, 0))
    
    
    End Function
    

    and put RANDOMIZE in your form_load

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 408k
  • Answers 408k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You have an (illegal) assignment instead of a comparison. Surely… May 15, 2026 at 6:58 am
  • Editorial Team
    Editorial Team added an answer Change $_GET['key'] == true to $_GET['key'] == "true" You do… May 15, 2026 at 6:58 am
  • Editorial Team
    Editorial Team added an answer In the view: forms = itertools.izip(base_forms, likes_forms) In the template:… May 15, 2026 at 6:58 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.