How do I automatically verify the value in 2 different tables???

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Before I start I must say I am completely new at Access.....

I am creating a form for an event nomination.
In this form I would like to have a checkbox and I'd like to be able to
verify if the entrant is a member of the group (non members have to pay more).

How do I create a checkbox that automatically verifies the first name/last
name record with the first name/last name record in the membership table and
ticks "yes" if this person exists in the list?
 
try something like this:

Private Sub Check1_AfterUpdate()

If Not IsNull(DLookup("[Name]", "tblNames", "[Name] =" & Me.Text0)) Then
'found it
Else
'didn't find
End If

End Sub
good luck!
 
Assuming that Name is a text field, the value must be put in quotes:

If Not IsNull(DLookup("[Name]", "tblNames", "[Name] =" & Chr$(34) & Me.Text0
& Chr$(34))) Then

And while I know this was just an example, I thought I'd mention that Name
is not a good name to call a field. It's a reserved word, and using reserved
words can lead to problems.


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



visdev1 said:
try something like this:

Private Sub Check1_AfterUpdate()

If Not IsNull(DLookup("[Name]", "tblNames", "[Name] =" & Me.Text0)) Then
'found it
Else
'didn't find
End If

End Sub
good luck!

Ivanka said:
Before I start I must say I am completely new at Access.....

I am creating a form for an event nomination.
In this form I would like to have a checkbox and I'd like to be able to
verify if the entrant is a member of the group (non members have to pay
more).

How do I create a checkbox that automatically verifies the first
name/last
name record with the first name/last name record in the membership table
and
ticks "yes" if this person exists in the list?
 
First, I would not use their first and last names as an id because there
could be persons with the first and last name. Each member should be
assigned a unique ID either automatically or manually. Then you can use the
DLookup method.
 
I inherited this database as I just started doing the memberships this year...
the table fields are:

surname
first name
Membership type
Current financial year
Date fees paid
.... and then the address details


Surname and firstname are both primary keys

My idea was that when I create a form for event nominations I should be able
to have an automated check between the first and last name of the nomination
and the membership list....

but now I get the idea that I need to recreate the entire database to make
this happen.....
 
Back
Top