----- Original Message -----
From: Martin Allen
To: Sarah Cheng
Sent: Sunday, December 23, 2001 9:09 PM
Subject: RE: message box
Hello
Sarah,
I
figured out what both problems were. The 3051 runtime error
was caused by the files that you sent me being read-only so I turned
that off.
Your
invalid qualifier was caused because you did not type frmQuiz.
before the txtName.Text, which meant Visual Basic could not find
txtName.Text.
Your
code:
Private
Sub cmdSubmit_Click()
Dim response As
Integer
If optAnswer(CorrectAns).Value
= True Then
response = MsgBox("Correct"&TxtName.text&)
Else
response = MsgBox("Wrong")
End If
Hide
End Sub
End Sub
Correct
code:
Private
Sub correct()
Dim answer As Integer
answer
= MsgBox("correct,
" & frmQuiz.txtName.Text,
vbOKOnly)
End Sub
Also,
it isn't necessary to have 'correct' and 'incorrect' procedures when
you could have it all in one procedure:
Private
Sub cmdSubmit_Click()
Dim response As
Integer
'
Display a suitable message and exit the form
If optAnswer(CorrectAns).Value
= True Then
' User clicked correct answer
MsgBox "correct, " &
frmQuiz.txtName.Text,
vbOKOnly
Else
MsgBox "wrong, " &
frmQuiz.txtName.Text,
vbOKOnly
End
If
Hide
' go back to main quiz form
End Sub
I
should have worked out that the read-only files were causing the
3051 error. Please contact me again if you have any further
problems.
Martin Allen
http://www.martin2k.co.uk/vb6
Hello martin,
this quiz program, is one of my school
project that i ahve to do.
I'm using visual working model package
to do this project. I don't know if that helps you.
I have never had a run time error
3051.
The school sets up the project and we
have to modify it.
I try sending the program again if
that helps.
----- Original Message -----
From: Martin Allen
To: Sarah Cheng
Sent: Saturday, December 22, 2001 5:43 PM
Subject: RE: message box
Hello
Sarah,
When
I try to open the program, I get the error:
Run-time
error '3051':
The
Microsoft Jet database engine cannot open the file
'C:\WINDOWS\DESKTOP\New Folder\Quiz.mdb'. It is already
opened exclusively by another user, or you need permission to
view its data.
I
know this is a different error to what you get. What do I
need to do to correct this? After this problem is solved,
I maybe able to help you with your problem.
Thanks,
Martin Allen
http://www.martin2k.co.uk/vb6