Yes, you can get your quiz to use Access database, or any other for that matter...
To use Access DB, you can use either ADO, DAO or Data control... I prefer to use DAO 3.6, so I'll explaint it quickly...
Before everything, add a reference to Microsoft DAO 3.6 object. Next, you need to create Database object, that will hold the database, and create Recordset object, that holds actual table with questions and answers...
CODE
Dim DB As Database
Dim RS As Recordset
Then, proceed to open database and table
CODE
Set DB = OpenDatabase("databasename.mdb")
Set RS = DB.OpenRecordset("tablename")
Now, I prefer to use SQL for search operations inside database, so here's how you get a group of questions, based on a first letter for example. I assume you have some basic knowledge of SQL (Structured Query Language). Like with filenames, * is a wildcard, and SQL syntax is fairly easily understandable...
CODE
SQL="SELECT * FROM tablename WHERE question LIKE ""A*"""
Set RS = DB.OpenRecordset(SQL)
Now, you may have noticed I used OpenRecordset, to execute SQL... This is a great way to create a recordset object, containing search results in your SQL query... Now, it is not neccesary to open the entire table, if you will be searching for specific questions... If you have some basic knowledge of databases, you will handle this easily... Here's the portion of the code you could use (it's not tested, but it should work, just replace database, table and field names with your own):
CODE
Dim DB As Database
Dim RS As Recordset
Dim SQL As String
Private Sub Form_Load()
Set DB = OpenDatabase("database.mdb")
End Sub
Private Sub Command1_Click()
SQL = "SELECT * FROM TableName WHERE FieldName LIKE ""A*"""
Set RS = DB.OpenRecordset(SQL)
RS.MoveLast
RS.MoveFirst
If RS.RecordCount > 0 Then
' Write your code to handle the results
Else
' No matches found, what to do, write here
End If
End Sub
If you need further help, drop me an e-mail...
Reply