Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19

Run-time error '424': Object required

  1. #16
    cowboy is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    281

    Wups, the pictures didnt upload last time.

  2. #17
    cowboy is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    281
    So I went a back alley way to solve this problem, if anyone thinks this is a good way or a bad way please let me know why so I can learn from it. Thanks

    Code:
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
        ShowPage
        sSizeChange ("txtLocationTest")
    End Sub
    Code:
    Sub sSizeChange(sz As String)
        Dim testlen As Long
        If IsNull(Me.Controls(sz)) = False Then
            testlen = Me.TextWidth(Me.Controls(sz))
            Me.Controls(sz).Width = testlen
        End If
    End Sub

  3. #18
    cowboy is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    281
    For some reason the .TextWidth control gets less accurate when it is small and large so I had to make some minor adjustments.

    Code:
    Sub sSizeChange(sz As String)
        Dim testlen As Long
        If IsNull(Me.Controls(sz)) = False Then
            testlen = Me.TextWidth(Me.Controls(sz))
            If testlen > 900 Then
                Me.Controls(sz).Width = testlen - (testlen * 0.1)
            ElseIf testlen < 600 Then
                Me.Controls(sz).Width = testlen + (testlen * 0.1)
            Else
                Me.Controls(sz).Width = testlen
            End If
        End If
    End Sub

  4. #19
    cowboy is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    281
    Wow, I had to call up microsoft and the access tech guy didnt even know how to use this property. Turns out the .textwidth uses the reports fontsize and fontname which is defaulted to Calibri size 8. These 2 properties can not be changed except with VBA. I believe I have everything working now but maybe this post will help someone else in the future.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 04-15-2010, 09:43 AM
  2. Replies: 3
    Last Post: 03-30-2010, 01:21 PM
  3. Object required
    By duckie10 in forum Access
    Replies: 1
    Last Post: 05-15-2009, 02:11 PM
  4. Replies: 2
    Last Post: 03-23-2009, 05:39 AM
  5. Replies: 2
    Last Post: 02-28-2009, 03:31 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
  •  
Tech Forums: Microsoft Office Forums