Re: Help w/ writing a If Statement

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: PC Datasheet (spam_at_nospam.spam)
Date: 02/18/04


Date: Wed, 18 Feb 2004 19:46:12 GMT

Create a query based on CardInfoTbl and include these fields in this order:
SSN
FName
LName

On your form add a combobox with the rowsource the above query. Make the bound
column 1, column count 3 and column widths 1.5;0;0. You can now select the SSN
on your form!

Put this code in the AfterUpdate event of the combobox:

Me!FName = Me!NameOfCombobox.Column(1)
Me!LName = Me!NameOfCombobox.Column(2)

This code will automatically fill your first and last name fields on your form
when you select a SSN.

--
                                         PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
                              resource@pcdatasheet.com
                                 www.pcdatasheet.com
"David Ehrenreich" <anonymous@discussions.microsoft.com> wrote in message
news:12ccf01c3f654$b5b15790$a501280a@phx.gbl...
> Here is what I'm trying to do.  In my form I have feilds
> for Ssn# FName, Lname.  Since the social and Fname and
> last name are always connected.  I would like it so that
> when I type in a ssn# the Fname and Last name are
> automatically entered into their feilds.  Here is what I
> have tried and it failed :).
>
> Private Sub Ssn_LostFocus()
>
> If Not IsNull(DLookup "ssn","CardInfoTbl", _
>  "ssn=")) Then
>      FName = Me.FName
>
>
> End If
> End Sub
>
> Thank You
> David Ehrenreich


Relevant Pages

  • Re: Help w/ writing a If Statement
    ... In the query for the combobox, sort SSN ascending. ... Since the social and Fname and>>> last name are always connected. ...
    (microsoft.public.access.formscoding)
  • Re: Help w/ writing a If Statement
    ... >In the query for the combobox, sort SSN ascending. ... From there you can easily find the student ...
    (microsoft.public.access.formscoding)
  • Re: Help w/ writing a If Statement
    ... >On your form add a combobox with the rowsource the above ... >when you select a SSN. ... >> for Ssn# FName, Lname. ... >> automatically entered into their feilds. ...
    (microsoft.public.access.formscoding)
  • RE: Error Handling question
    ... Using the built-in features of the combobox, you can link it the specific ... that the user hits once he has chosen a ssn. ... A message pops-up evrytime a wrong entry is entered. ...
    (microsoft.public.excel.programming)
  • Re: Modified Access query does not respect ORDER!
    ... Close the query. ... But the SQL says it uses fname. ... Creating a report with the wizard uses the "invisible" order by lname. ...
    (microsoft.public.access.queries)