Positioning objects using VB

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NCRStinks
    New Member
    • Jul 2007
    • 45

    #1

    Positioning objects using VB

    Hi There

    Usually in the access forums, but trying to get a little more adventurous... Unfortunately not having much luck!

    Trying to achieve an "Outlook" type calender for a report in access. Very similar to the example on http://www.access.hookom.net/Samples.htm

    [CODE=vb]Private Sub Detail_Format(C ancel As Integer, FormatCount As Integer)Dim TopMargin As Long
    Dim OneMin As Long
    Dim DayStart As Date
    Dim StartTime As Date
    Dim EndTime As Date

    DayStart = #10:00:00 AM#
    OneMin = 15
    TopMargin = 1440

    Me.MoveLayout = False

    Me.Customer.Top = TopMargin + (DateDiff("n",D ayStart,StartTi me) * OneMin
    Me.Customer.Hei ght = (DateDiff("n", StartTime, EndTime))
    Me.Customer.Lef t = 1440

    End Sub[/CODE]

    I have practically copied the code from the example but I am receiving an error message: The control or subform is too large for this location (error 2100)

    I am using MS Access 2007, the data that "fills" StartTime = 10:00, EndTime 13:00

    Any help would be much appreciated, or whether I should post this in the Access forum - I was unsure!

    Many Thanks

    Dan
    Last edited by Killer42; Oct 7 '07, 12:49 PM.
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Which line produces the error?

    Hm... on further consideration, perhaps the problem is that DateDiff will be producing a negative number, since StartTime is actually zero.

    Comment

    • NCRStinks
      New Member
      • Jul 2007
      • 45

      #3
      Originally posted by Killer42
      Which line produces the error?

      Hm... on further consideration, perhaps the problem is that DateDiff will be producing a negative number, since StartTime is actually zero.
      Hi There

      I have managed to sort out this problem. Using the "TimeValue" function. I think with saving the field as "date/time" in access even when only typing a time, it attaches a date to it too.

      By using the TimeValue, i have been able to eliminate the error.


      Many Thanks


      Dan

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Ok. Glad to see you've got it sorted. :)

        Comment

        Working...