last thing 2

J

Jimmy Warpup

this is what i'm trying to do.

the following code works fine.


Private Sub French_Word_BeforeUpdate(Cancel As Integer)

A = IsNull(DLookup("[French_Word]", "[Dictionary]", "[French_Word] = """ &
Me![French_Word] & """"))
Select Case A
Case False
MsgBox "The word " & Me!French_Word & " has already been entered."
Cancel = True
Exit Sub
Case Else
Exit Sub
End Select

End Sub

all I want to do is define B = DLookup("[English_Tranlation]",
"[Dictionary]", "[French_Word] = """ & Me![French_Word] & """") and then
change the line under "case false" to read:


MsgBox "The word " & Me!French_Word & " has already been entered. It means
" & B


the line A = DLookup("[French_Word]", "[Dictionary]", "[French_Word] = """ &
Me![French_Word] & """") works fine. it gets the french_word value from the
table that is the same as the entered value
the line B = DLookup("[English_Tranlation]", "[Dictionary]", "[French_Word]
= """ & Me![French_Word] & """") only works if the "English_translation"
field in the form is populated in which case it returns the value in that
field. Otherwise it says "invalid use of null."

even the line "B = dlookup("[English_Translation]", "[Dictionary]") does the
same thing.
doesn't seem to make any sense, it looks at the table in one instance and
the form in the other...

help please?




but when I do B gets defined as the form field "english_translation" not in
the dictionary table. So if i put something in the english translation
field then go back and populate french word the sub returns whatever i put
into "english_translation" which means that my dlookup is only looking on
the form not in the table. but when i do
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top