• Blank Records (WIN XP/Access 2003)

    Author
    Topic
    #435667

    When I open my form, the Record# field is being populated (which I do not want until the user begins to enter data). If the user decides not to even start the record and closes the form, the record is in the table blank except for the Record#.. This creates many blank records over the course of a week. I just wind up deleting them.

    The only code I have regarding the form is in Form_Open :

    DoCmd.GoToRecord , , acNewRec

    DoCmd.GoToControl “txtDATE_WORKED”

    I have this same exact code in other databases, but the Record# field is not populated until they fill in any field on the form.

    I

    Viewing 0 reply threads
    Author
    Replies
    • #1030380

      I think we’d have to see the database. Could you post a stripped down copy of your database? See post 401925 for instructions.

      • #1030390

        Thank you Hans. I am going to take this as a lesson learned. When I am given an issue I need to investigate much more thoroughly. I try my best not to post here unless I have no other options.
        After re-reviewing the form’s code, I found this in the “Form_Current”:
        If cboHMO = “HPSJ” Then
        lblReport_Date.Visible = True
        txtREPORT_DATE.Visible = True
        Else
        lblReport_Date.Visible = False
        txtREPORT_DATE = “”
        txtREPORT_DATE.Visible = False

        End If

        Apparently the highlighted line of code was causing my issue. I don’t know “why”, but when I commented out that line, all was normal again.

        Thank you once again !

        Michael

        • #1030393

          The bolded line enters a value in txtReport_Date.
          If you’re in a new record, it becomes “real” the moment you enter something in it, and that is precisely what the bolded line does. If you need it for existing records, you could use

          If Not Me.NewRecord Then
          txtReport_Date = “”
          End If

          (By the way, I’d use txtReport_Date = Null to clear a field. Entering an empty string “” doesn’t really clear the field)

          • #1030394

            I will ABSOLUTELY change my code – thank you for the explanation Hans. As always, I do appreciate your generosity.

            Michael

    Viewing 0 reply threads
    Reply To: Blank Records (WIN XP/Access 2003)

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

    Your information: