Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access form for Word & Definition Testing

Status
Not open for further replies.

ghcrazy8

MIS
Apr 17, 2006
20
US
I have created a 2007 Access Database form in which I want to use to test myself in studying definitions. The form has the definition from "Table1" and a list box which pulls from a query with ALL the words in "table1". I have added a Click Event to the list box. When I click on the word in the list box, I want it to give me a messagebox saying "you are correct" or "your are incorrect". That is if the definition showing matches the word i click on. They would be the same record in the table1. The field names are "definition" and "word". Here is my VB code:

Private Sub LstWordList_Click()

If LstWordList.Selected = table1.Word Then
MsgBox "you are correct"
Else
MsgBox "you are incorrect"
End If


The error i'm getting is:

Compiler error:

Argument not optional

the word .selected is highlighted in yellow.

I'm not sure where I'm going wrong here, but I think it's relatively simply, just can't put my finger on it.
I'm not sure if I need to declare the database or table?

Any help is appreciated.


 
I would create a text box in the form that is bound to the [Word] field and make it invisible. The code would then look something like:
Code:
    If Me.txtHiddenWord = Me.LstWordList Then
        MsgBox "you are correct"
     Else
        MsgBox "you are incorrect"
    End If


Duane
Hook'D on Access
MS Access MVP
 
Thank you so much. This worked perfectly.

I knew it was fairly simply, just couldn't wrap my brain around it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top