• Contents of field doesn’t show on form (A2K)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Contents of field doesn’t show on form (A2K)

    • This topic has 5 replies, 4 voices, and was last updated 23 years ago.
    Author
    Topic
    #368989

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

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

    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

    Viewing 1 reply thread
    Author
    Replies
    • #579687

      First of all, why not use:

         Me![date received] = Date( )
      

      If you continue to have problems, try this immediately after your other code:

         Me.Repaint
      
      • #579691

        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

        • #579697

          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…

        • #579793

          >>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?

    • #579831

      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?

    Viewing 1 reply thread
    Reply To: Contents of field doesn’t show on form (A2K)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: