Results 1 to 5 of 5

Thread: Why Won't this work?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Location
    Tucson, AZ, USA
    Posts
    95
    OK, I have this code, pretty straight forward I thought.

    Dim TempImage as String
    TempImage = rsName.Fields("Image").Value
    If TempImage = "" Then
    picComic.Picture = LoadPicture(App.Path & "\blank.gif")
    Else
    picComic.Picture = LoadPicture(rsName.Fields("Image").Value)
    End If

    In other words I have a MSaccess Database with an Image field. I want the code to load a standard image when nothing is in the image field. The other half of the statement works when there something in the field. Or in I add like "none" to the image field, and change the code from

    If TempImage = "" TO If TempImage = "none"

    Then it works fine.

    Any suggestions are helpful. Thanks

    Ed

  2. #2
    Lively Member
    Join Date
    Aug 2000
    Posts
    125
    [code]
    If rsName.Fields("Image").FieldSize > 20 Then
    Set picComic.Picture = LoadPicture(App.Path & "\blank.gif")
    Else
    SetpicComic.Picture = LoadPicture(rsName.Fields("Image").Value)
    End If
    [code]

    http://pages.about.com/vbmakai/dao5.htm

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Location
    Tucson, AZ, USA
    Posts
    95

    No Worky

    Makai,
    Thank for the attempt, but that does not work either. That causes it to do neither of the statements.



    Anyone else have an idea? Please

  4. #4
    Hyperactive Member
    Join Date
    Feb 2000
    Posts
    284
    I think what you need to do here is change the second line to

    TempImage = "" & rsName.Fields("Image").Value

    and optionally, for efficiency change the 3rd line to
    If TempImage = vbnullstring Then

    I am guessing somewhat though because you haven't actually said what happens when there is nothing in the field. If I am wrong give some more detail and sure we'll sort it out

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Location
    Tucson, AZ, USA
    Posts
    95

    That did it

    That worked perfect, thank you very much

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width