check for redundent entires onexit

J

Jimmy Warpup

Hey,



I'm creating a database to help teach foreign language. I've made the form
and it's really cool, but if I input a redundant value it doesn't tell me
until the end of the form. there're like 50 items on the form, so it's a
big waste of time when an entry is recreated.



I'd like to make it so that when you tab out of the first field (called
"French_word") it checks that entry against the existing database. If it is
I want to display that entry. if it isn't i just want it to move on.



I'm in way over my head here. this whole project was a bit out of range for
me, this is just way out of my league. any help would be appreciated.



Jimmy
 
J

John W. Vinson

Hey,



I'm creating a database to help teach foreign language. I've made the form
and it's really cool, but if I input a redundant value it doesn't tell me
until the end of the form. there're like 50 items on the form, so it's a
big waste of time when an entry is recreated.

Before we worry about the form... let's talk about the table. How is it
structured? Do you have fifty *FIELDS* in the table - perhaps one for each
language? If so you may want to reconsider your design!
I'd like to make it so that when you tab out of the first field (called
"French_word") it checks that entry against the existing database. If it is
I want to display that entry. if it isn't i just want it to move on.

Put code in the textbox's BeforeUpdate event like:

Private Sub French_word_BeforeUpdate(Cancel as Integer)
If Not IsNull(DLookUp("[French_word]", "[tablename]", _
"[French_word] = """ & Me![French_word] & """") Then
Cancel = True
MsgBox "The word " & Me!French_word & " already exists", vbokonly
End If
End Sub

Do note that it's quite possible that two or more different English words
might correspond to the same French word, or vice versa. I'm very skeptical of
the logic of this entire table!!
 

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

Similar Threads


Top