Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Module to change row/record height

Status
Not open for further replies.

ossse

Programmer
Jun 26, 2007
49
US
I am trying to run an access module that changes the row/record height of a table (table name = "Filtered"). I'm not sure where I am going wrong. The program runs fine but the row heights are never changed.

Here is my code

Code:
Sub rowheight()

Dim dbs As DAO.Database, rst As DAO.Recordset

Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("Filtered")

SetTableProperty dbs![Filtered], "RowHeight", dblong, 900
DoCmd.OpenTable "Filtered", acViewNormal

End Sub

Sub SetTableProperty(tdfTableObj As TableDef, strPropertyName As String, _
        intPropertyType As Integer, varPropertyValue As Variant)
    ' Set Microsoft Access-defined table property without causing
    ' nonrecoverable run-time error.

Const conErrPropertyNotFound = 3270
    Dim prpProperty As Property
    On Error Resume Next                ' Don't trap errors.
    tdfTableObj.Properties(strPropertyName) = varPropertyValue
    If Err <> 0 Then                    ' Error occurred when value set.
        If Err <> conErrPropertyNotFound Then
            On Error GoTo 0
            MsgBox "Couldn't set property '" & strPropertyName _
                & "' on table '" & tdfTableObj.Name & "'", 48, "SetTableProperty"
        Else
            On Error GoTo 0

Set prpProperty = tdfTableObj.CreateProperty(strPropertyName, _
                intPropertyType, varPropertyValue)
            tdfTableObj.Properties.Append prpProperty
        End If
    End If
    tdfTableObj.Properties.Refresh
End Sub

Note: I got 'SetTableProperty' from the Access Help

THANKS!!!
 
thread705-1386886

Probably not the answer you're looking for, but it is what it is.


~Melagan
______
"It's never too late to become what you might have been.
 
A form in datasheet view has a Row Height property.

[tt]Me.RowHeight = 1250 'twips[/tt]

As the link posted by Melagen says, do not expose tables to users.
 
Code:
Set prpProperty = tdfTableObj.CreateProperty(strPropertyName, _
                intPropertyType, varPropertyValue)
            tdfTableObj.Properties.Append prpProperty
does it actuly run this line of code

put a brakepoint at this line and see if it stops there
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top