Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Feb 2002
    Posts
    74
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Contents of field doesn't show on form (A2K)

    I have a form that has the following in the LostFocus event for a date field:

    <pre>If IsNull(Me![Date Received]) Then
    Me![Date Received] = Format(Now(), "mm/dd/yy")
    End If</pre>


    This worked fine for a long while to fill in the current date if the user didn't enter one of their own.

    The problem: the date stopped showing in the field although it is really there. If I Tab past the field, then Back Tab onto the field, I can see that the date is in focus, although I can't see it. If I press F2 it becomes visible.

    This is probably something really stupid, but I've looked at everything and still can't figure this one out. Any tips would be appreciated.

    Thanks,

    Randy
    GHH3RD

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Contents of field doesn't show on form (A2K)

    First of all, why not use:
    <pre> Me![date received] = Date( )
    </pre>


    If you continue to have problems, try this immediately after your other code:
    <pre> Me.Repaint
    </pre>

    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Star Lounger
    Join Date
    Feb 2002
    Posts
    74
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Contents of field doesn't show on form (A2K)

    Mark -

    Thanks. I did this in my very early days of Access, and Date will work fine, but it doesn't solve my problem. I had also tried Me.Repaint before, and just now again, but that doesn't do it either. The odd thing is that after I pass the field and then back tab to it, I can tell that it puts the date in focus because it makes a 1/2" black bar in the field - if I press F2 at that time the date become visible.

    Or, if I just tab past the field and save the record, the date is written to the record.

    Why oh why won't my date show in the first place?

    Thanks,

    Randy

  4. #4
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Richland, Washington, USA
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Contents of field doesn't show on form (A2K)

    This is a long shot, but is this field the last one in the Tab Order and is the Cycle property for the form set to "All Records"? If so (for both) then you may be tabbing to a new record that is blank (shift-Tab will take you back to the previous filled-in record). I suspect this would be obvious from the behavior of other fields on the form though...

  5. #5
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Contents of field doesn't show on form (A2K)

    >>I did this in my very early days of Access, and Date will work fine<<

    I don't understand why you would not use the simple Date( ) instead of the more complicated format function?

    But anyway. Where is the focus when set the value of this field. Is it on this field, or another field? What are the background and foreground colors of this field? Does this field display OK at other times; that is, when redisplaying an existing record, for example?
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Contents of field doesn't show on form (A2K)

    Check the format on the control. What you describe doesn't sound right, but if the date is really there, it sounds like either an input mask or format gumming up the works. BTW, is [Date Received] a date/time field?
    Charlotte

Posting Permissions

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