Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Sacramento, California, USA
    Posts
    491
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Blank Records (WIN XP/Access 2003)

    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

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Blank Records (WIN XP/Access 2003)

    I think we'd have to see the database. Could you post a stripped down copy of your database? See <post#=401925>post 401925</post#> for instructions.

  3. #3
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Sacramento, California, USA
    Posts
    491
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Blank Records (WIN XP/Access 2003)

    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

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Blank Records (WIN XP/Access 2003)

    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)

  5. #5
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Sacramento, California, USA
    Posts
    491
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Blank Records (WIN XP/Access 2003)

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

    Michael

Posting Permissions

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