Results 1 to 5 of 5
  1. #1
    fender357 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Location
    La Habra, Ca
    Posts
    12

    Hopefully simple If Then

    I'm so close to getting this to work, but I'm not quite sure how to get this written out correctly.



    Pretty much what I want this to do is...

    If <not a date> or <not containing "Partner*" or "Tech*"> Then

    So far I've got
    Code:
    If IsDate(inpStr) = False  Then
    and that works to tell me what is not a date.
    I'm stuck on finding where (inpStr) is not a date and does not start with "Partner" or "Tech".

  2. #2
    spkoest is offline Novice
    Windows Vista Access 2007
    Join Date
    Jun 2009
    Posts
    16
    Maybe something along these lines...

    If IsDate(inpStr) = False Then
    If Not (InpStr Like "Partner*") then
    If Not (InpStr Like "Tech*") then
    do something
    End if
    End if
    End IF

  3. #3
    jaykio77 is offline Novice
    Windows XP Access 2003
    Join Date
    May 2011
    Posts
    2
    try
    if not isdate(inpStr) then
    if left(inpStr,7) = "Partner" then
    msgbox inpStr & " starts with partner"
    end if
    if left(inpStr,4) = "Tech" then
    msgbox inpStar & "starts with Tech"
    end if
    else
    msgbox inpStr & " is a date"
    end if

  4. #4
    fender357 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Location
    La Habra, Ca
    Posts
    12
    The only thing I'm worried about is that there is already a lot more code after what was in there originally. Originally this line was just looking for space that wasn't blank but now it's trying to do what I've explained.

    Here's a bit more of the code in this section.

    Code:
      ' is this a data line?
          If IsDate(inpStr) = False Then
             ' split the lind using comma as the delimiter
             TestArray = Split(inpStr, DelimitChar)
             'check if a name line
             If InStr(1, TestArray(2), "(x") Or InStr(1, TestArray(1), "(x") Then
                WorkerName = Trim(TestArray(1)) & ", " & Trim(TestArray(2))
                WorkerName = Replace(WorkerName, """", "")

  5. #5
    fender357 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Location
    La Habra, Ca
    Posts
    12
    Thanks spkoest!
    That did it!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Simple Syntax Help
    By cvegas in forum Programming
    Replies: 7
    Last Post: 04-20-2011, 01:46 PM
  2. Simple Query
    By tombsy in forum Access
    Replies: 2
    Last Post: 02-01-2011, 09:48 AM
  3. Replies: 0
    Last Post: 10-21-2010, 08:24 AM
  4. Simple Export Not So Simple
    By jgelpi16 in forum Programming
    Replies: 11
    Last Post: 09-01-2010, 07:23 AM
  5. This must be simple but.....
    By adi in forum Access
    Replies: 11
    Last Post: 07-30-2010, 06:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums