Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

Parsing names in a field

Discussion in 'Information Technology' started by Scoop, Nov 6, 2005.

  1. Scoop

    Scoop
    Expand Collapse
    Guest

    I am using slightly modified versions of the "NameTitle" and
    "NameFirst" functions posted in the following thread:

    http://groups.google.com/group/microsoft.public.access/browse_thread/thread/6b092d07d7fa528e

    I've got them working well (many thanks to Terry Wickenden and those
    who have re-posted it) with one exception. The database that I am
    trying to clean up has some records where the field that I am parsing
    is NULL. It generates a datatype mismatch.

    Can someone tell me how to modify either/both of these functions to
    check if the field is NULL and skip if it is.

    Thanks,

    Scott
     
  2. Loading...

    Similar Threads Forum Date
    Politics These are the names of 21 children killed in Gaza Breaking News Jul 12, 2014
    Sikh Names... Ideas? Sikh Sikhi Sikhism Jul 5, 2014
    Canada Canada names park after first Sikh settler Breaking News Jan 15, 2014
    India Sikhs of Northeast, South India Don't Flaunt Surnames: Study Breaking News Aug 29, 2013
    Canada Employers Favour English-sounding Names Breaking News Oct 14, 2011

  3. Brendan Reynolds

    Brendan Reynolds
    Expand Collapse
    Guest

    If you're using the functions in an update query, the easiest solution is to
    add "WHERE FieldName IS NOT NULL" to the query. Alternatively, you can use
    the NZ function. Instead of NameFirst(YourFieldName) use
    NameFirst(NZ(YourFieldName, "")). Alternatively again, modify the functions
    like so ...

    Public Function NameFirst(varPass As Variant) As Variant

    If IsNull(varPass) Then
    NameFirst = Null
    Exit Function
    End If
    'original function code here

    --
    Brendan Reynolds

    "Scoop" <imscoop22@gmail.com> wrote in message
    news:1131217656.982848.229550@f14g2000cwb.googlegroups.com...
    >I am using slightly modified versions of the "NameTitle" and
    > "NameFirst" functions posted in the following thread:
    >
    > http://groups.google.com/group/microsoft.public.access/browse_thread/thread/6b092d07d7fa528e
    >
    > I've got them working well (many thanks to Terry Wickenden and those
    > who have re-posted it) with one exception. The database that I am
    > trying to clean up has some records where the field that I am parsing
    > is NULL. It generates a datatype mismatch.
    >
    > Can someone tell me how to modify either/both of these functions to
    > check if the field is NULL and skip if it is.
    >
    > Thanks,
    >
    > Scott
    >
     
  4. Scoop

    Scoop
    Expand Collapse
    Guest

    Thanks, Brendan. I'll give it a shot.

    One thing to mention...I am using a SELECT query to "stage" the data
    from a table in an old database. In this query I am changing field
    names/data types to be consistent with a table in a new database.
    After staging the data, I have an APPEND query that dumps the data into
    the new table.

    So, I don't think I can use "WHERE FieldName IS NOT NULL" b/c I need
    all the records. Everything actually works, it just bugs me that that
    when I use the following to extract the "Title" for a name:

    Title: NameTitle([MasterList]![First Name])

    ....the query shows #Error where the original fields are NULL.
     
  5. Brendan Reynolds

    Brendan Reynolds
    Expand Collapse
    Guest

    You could use ...

    Title: NameTitle(NZ([MasterList]![First Name],"")

    .... which would display nothing for the Title in the SELECT query, however,
    in the APPEND query, you'll get an empty string in the target field instead
    of a Null value, which may not be what you want. An alternative would be ...

    Title: IIf([MasterList]![First Name] IS NULL, Null,
    NameTitle([MasterList]![First Name]))

    --
    Brendan Reynolds


    "Scoop" <imscoop22@gmail.com> wrote in message
    news:1131224355.347483.204020@g49g2000cwa.googlegroups.com...
    > Thanks, Brendan. I'll give it a shot.
    >
    > One thing to mention...I am using a SELECT query to "stage" the data
    > from a table in an old database. In this query I am changing field
    > names/data types to be consistent with a table in a new database.
    > After staging the data, I have an APPEND query that dumps the data into
    > the new table.
    >
    > So, I don't think I can use "WHERE FieldName IS NOT NULL" b/c I need
    > all the records. Everything actually works, it just bugs me that that
    > when I use the following to extract the "Title" for a name:
    >
    > Title: NameTitle([MasterList]![First Name])
    >
    > ...the query shows #Error where the original fields are NULL.
    >
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page