Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Null values (Access03)

    I have a form that has 3 subforms. I have it set to pass from the form to each subform the date entered. The date is passed on the first date field's After Update event. The Department form has three fields that can't be null. The problem is when the date is passed to the Department form I get an error message saying that the fields can't be null. Is there anyway to avoid that message?

    Thanks Fay

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

    Re: Null values (Access03)

    More information is needed in order to answer your question. What are you trying to *do* with the date on these subforms? Is your code creating a record immediately? That's what is suggested by your description, and I doubt that you really want to do that. If you explain further and/or post a stripped down copy of the form/subforms, someone should be able to help.
    Charlotte

  3. #3
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Null values (Access03)

    I think that the form is immediately creating the record for the department. I was trying to cut down typing the same date four times.

    I couldn't make the 100 limit so I placed it on my site at http://www.awarenessproductions.com/my.htm. Then click the database link to download the zipped file.

    Thank you. Fay

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

    Re: Null values (Access03)

    Instead of setting the value of the date, set its Default Value:

    Private Sub FirstWorkDate_AfterUpdate()
    Me!FTE.Form!StartDate.DefaultValue = "#" & Me!FirstWorkDate & "#"
    Me!Department.Form!StartDate.DefaultValue = "#" & Me!FirstWorkDate & "#"
    Me!Salary.Form!StartDate.DefaultValue = "#" & Me!FirstWorkDate & "#"
    End Sub

    These values will be visible immediately, but they will only become effective when something is entered in the department subform.

  5. #5
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Null values (Access03)

    Thank you Hans. I would never have thought about putting it in as a default value. Those types of tricks are what makes these newsgroups and people like you and Charlotte and others so valuable to those that are just learning.

    Thank you. I hope you have a great day.

    Fay

Posting Permissions

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