Results 1 to 13 of 13
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    2,097

    It seems one cannot aquire the "Y" coordinate of a text box on a continuous form.

    I've tried to use the MouseDown Event to determine the "Y" coordinate of a text box within a continuous form, but the value returned is the same no matter which of the displayed records is clicked. I get the desired value if I click anywhere on the form corresponding to the "Detail" section but not if I click on a text box. Even clicking on the Record Selector adjacent to the text box of interest yields the desired value.

    Google and forum searches have yielded zip. Hard to believe there's not a way.

    Any ideas?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Is this what you want - see post 13 https://www.accessforums.net/forms/h...orm-49515.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    2,097
    msgbox Me.Recordset.AbsolutePosition displays a valid value if I click on the record selector, but zero
    if I click on any of the fields within the record.

  4. #4
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    2,097
    The app is the use of Allen's popup calendar. I just want to position the popup in reasonable vicinity of the date text box. The "X" value is constant, but the "Y" value would float up and down the form.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Interesting, the OP for that thread says it solved their issue which seems to be the same thing you want.

    Only other approach I can think of would be to use CurrentRecord, which also did not occur to me during that thread but did for https://www.accessforums.net/program...ord-49824.html

    intTop = 3600 + Me.CurrentRecord * ctrl.Height
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    2,097
    The app is the use of Allen's popup calendar. I just want to position the popup in reasonable vicinity of the date text box. The "X" value is constant, but the "Y" value would float up and down the form.

  7. #7
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    2,097
    1500 + Me.CurrentRecord * Me.tbDOE.Height yields the desired value ONLY if the 1st record is the top record in the display. If I can somehow find out the record number that heads the display of a continuous form then I think we've got this one solved. BTW, "1500" is the height of the header section. Would be nice to get that from Access in code?

  8. #8
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    2,097
    These two approaches yield the same values.

    MsgBox 1500 + Me.CurrentRecord * Me.tbDOE.Height & " " & 1500 + (Me.Recordset.AbsolutePosition + 1) * Me.tbDOE.Height

    But again, ONLY when record number 1 is the 1st record in the display of the continuous form.

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I just tested, again, Me.CurrentRecord in the click event of a textbox and it returns correct value. If I click in the textbox on the 5th record, the CurrentRecord value returned is 5. Also tested Me.Recordset.AbsolutePosition in the same procedure and it returns 4.

    What event are you putting code into?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  10. #10
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    2,097
    The code is in the OnClick event of the text box. Again, both approaches work okay as long as the 1st record displayed is also the 1st record in the current recordset. If the vertical scroll bar shifts the display down in the recordset then both approaches will follow and the resulting values are no longer correct relative to the top of the Detail section.

    If I can somehow find out which record is at the top of the display, then simple arithmetic will get me what I'm after.

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Okay, vertical scroll bar does throw a kink in the setup. I am guessing the OP in other thread has not run into that yet. Sorry, got nothing for that.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  12. #12
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    2,097
    No way to determine which record in the current recordset is at the top of the display?

  13. #13
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    2,097
    Unless someone can tell me how to determine which record within the current RecordSet is being displayed at the top of the detail section of the current continuous form, below is my best solution.

    Code:
    Private Sub tbDOE_Click()
    Dim dummy As Date
    Dim intMaxCalTop
    '*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
    ' Other than launching Allen Browne's pop-up calendar, the primary task is to determine
    ' as well as can be the "Top" coordinate for the pop-up.
    '
    ' Things only become un-certain when the display is scrolled beyond where the first
    ' record "displayed" IS NOT also the first record in the RecordSet.  To make the
    ' best of the situation, we take into consideration the current window height minus
    ' the current height of the detail section minus the amount of space occupied by the
    ' top and bottom of the the window and use that to set the maximum value to be used
    ' in positioning the top of the pop-up calendar.  Not the best, but handles 99% of
    ' the observed cases.
    '
    ' intCalTop and intCalLeft are global and used by frmCalendar to position itself.
    '
    ' DetailHt is the amount of vertical space used to display one record within the
    ' Detail section of the display.  NOT THE SAME as Me.tbDOE.Height
    '
    ' CalMidLine is the offset from the top of frmCalendar to the horizontal line between
    ' the days of the week and days of the month.
    '
    ' ALL values are in Twips
    '*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
    
    intMaxCalTop = Me.WindowHeight - Me.Section(1).Height - intWinFraming - DetailHt
    
    intCalTop = Me.WindowTop + Me.Section(1).Height + Me.CurrentRecord * DetailHt - CalMidLine - DetailHt
    If intCalTop > intMaxCalTop Then intCalTop = intMaxCalTop - CalMidLine
    
    intCalLeft = Me.WindowLeft + Me.tbDOE.Left + 1260 + 200    'plus some emperical values to tweek the position
    
    dummy = CalendarFor([tbDOE], "Date of Transaction")
    End Sub

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 09-03-2014, 03:27 AM
  2. Replies: 3
    Last Post: 06-06-2013, 08:22 AM
  3. Replies: 3
    Last Post: 04-22-2013, 06:08 AM
  4. Export "Query or Report" to a "Delimited Text File"
    By hawzmolly in forum Import/Export Data
    Replies: 3
    Last Post: 08-31-2012, 08:00 AM
  5. Replies: 0
    Last Post: 09-25-2008, 12:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums