Page 1 of 2 12 LastLast
Results 1 to 15 of 26
  1. #1
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Gap Days in a Subform Record Source (2003)

    I think you left out an essential module. There are many undefined functions in the code, so nothing works.

  2. #2
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Gap Days in a Subform Record Source (2003)

    Oh yes, sorry Hans <img src=/S/blush.gif border=0 alt=blush width=15 height=15>
    How's about now? <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

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

    Re: Gap Days in a Subform Record Source (2003)

    I don't understand what the form does.

  4. #4
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Gap Days in a Subform Record Source (2003)

    It collects data which ends up in the Previsioni table.

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

    Re: Gap Days in a Subform Record Source (2003)

    When I click on one of the buttons, I see one or more message boxes in Italian, but I cannot enter any data.

  6. #6
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Gap Days in a Subform Record Source (2003)

    By clicking the calendar button(Comando50) on the startup form of the attached mdb, picking a date and clicking the button labelled "Insert Date", the user can insert 24 new records, belonging to the same day, into the Prev subform record source (the "Previsioni" table). Suppose the user forgets to enter, say, February 2, 2006 using the "Insert Date" button and, on the other hand, inserts the following days so the Previsioni table has a missing day.
    What is the best way to go about detecting the missing day so that a message box can warn the user upon opening the startup form?

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

    Re: Gap Days in a Subform Record Source (2003)

    The screenshot shows what happens if I click on the calendar, select 3 February 2006 and click Salva: no new records are displayed, and I cannot do anything.

    (Could you PLEASE stop attaching databases with missing references! I have asked this several times before)

  8. #8
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Gap Days in a Subform Record Source (2003)

    The Save button on the frmCalendarOCX form only fills the Cdata text box on the FDezzo form with the date selected on the calendar. It's the "Insert Date" button oh the main form that's supposed to add 24 new records to the subform record source.

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

    Re: Gap Days in a Subform Record Source (2003)

    You don't believe in making it easy, do you?

    The database still has references to OWC11 and Excel11 that aren't needed and that don't work if you have Office 2000 or XP <img src=/S/smash.gif border=0 alt=smash width=30 height=26>
    You use a non-existing function IsNothing 5 times. <img src=/S/bash.gif border=0 alt=bash width=35 height=39>
    Clicking the Inserisci Data button results in "Type mismatch" because of [CData]-1. This can be corrected by using DateAdd("d",-1,Me.Cdata).
    I then get an "Incorrect SQL" error at rst.Open "letture" because there is no table named letture.
    <img src=/S/igiveup.gif border=0 alt=igiveup width=31 height=23>

  10. #10
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Gap Days in a Subform Record Source (2003)

    Sorry, Hans, I've taken out unnecessary buttons, added the missing reference <img src=/S/blush.gif border=0 alt=blush width=15 height=15> and added more info to the post starting this thread so that hopefully now it's clearer what the form is supposed to do.
    Do you think now there's a way to detect a user skipping inserting a day?

  11. #11
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Gap Days in a Subform Record Source (2003)

    Please forgive me Hans, I've realised there were all those problems left after I posted my last message. Please give it one last shot, I've spent more than an hour cleaning up as much as I could out of the file in order to make space for the missing tables(and I've had to leave them blank otherwise the file size wouldn't fit 100kB). I didn't include the missing tables at the outset because I thought since my question was about detecting missing days in the Previsioni table, the other tables didn't matter. I obviously was wrong. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

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

    Re: Gap Days in a Subform Record Source (2003)

    I now get an error on the line

    DoCmd.GoToRecord , , acGoTo, a

    Whatever I change a to (acFirst, acLast) I get a message that Access cannot go to the specified record.

    Does this work? (Code added by me in bold)

    If IsNull(<!t>[Cdata]<!/t>) Then
    Exit Sub
    Else
    d = DCount("*", "previsioni", "Giorno=#" & _
    Format(DateAdd("d", -1, Me.Cdata), "mm/dd/yyyy") & "#")
    If d = 0 Then
    MsgBox "There are no records for the previous day!", vbExclamation
    Exit Sub
    End If

    Set cnn = CurrentProject.Connection

  13. #13
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Gap Days in a Subform Record Source (2003)

    Thank you so much Hans,
    the error on the line
    <font color=red>DoCmd.GoToRecord , , acGoTo, a </font color=red>
    occurs because the record to go to is in the Prev subform.
    I've tried to solve it by using
    <font color=448800> DoCmd.SelectObject acDataForm, "prev"
    DoCmd.GoToRecord , , acGoTo, a </font color=448800>
    to no avail.
    How can you select the Prev subform after inserting 24 new records and position the cursor on the first record, i.e. where Ora = 1?

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

    Re: Gap Days in a Subform Record Source (2003)

    "a" is not valid.

    Try

    Me.MG1Maz.SetFocus
    Me!MG1Maz!Sede.SetFocus
    RunCommand acCmdRecordsGoToFirst

    The Prev subform is named MG1Maz, and the text box bound to G1aptur is named Sede - very logical!

    Why are all those Maschera forms opened? They don't work! <img src=/S/bash.gif border=0 alt=bash width=35 height=39>

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

    Re: Gap Days in a Subform Record Source (2003)

    I don't get an error message when I do that.

Page 1 of 2 12 LastLast

Posting Permissions

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