Connecting Tech Pros Worldwide Help | Site Map

table setting with vba

  #1  
Old September 4th, 2006, 10:45 PM
tom taol
Guest
 
Posts: n/a


i want to set inputmask, comment, caption... of fields of the table
using vba.
manual work is difficult.

*** Sent via Developersdex http://www.developersdex.com ***
  #2  
Old September 5th, 2006, 01:05 AM
Allen Browne
Guest
 
Posts: n/a

re: table setting with vba


The code below illustrates how to set the property, creating it if
necessary.

Example usage:
? SetPropertyDAO(CurrentDb.TableDefs("Table1").Field s("Field1"),
"Format", dbText, "Short Date")


Function SetPropertyDAO(obj As Object, strPropertyName As String, intType As
Integer, varValue As Variant, Optional strErrMsg As String) As Boolean
On Error GoTo ErrHandler
'Purpose: Set a property for an object, creating if necessary.
'Arguments: obj = the object whose property should be set.
' strPropertyName = the name of the property to set.
' intType = the type of property (needed for creating)
' varValue = the value to set this property to.
' strErrMsg = string to append any error message to.

If HasProperty(obj, strPropertyName) Then
obj.Properties(strPropertyName) = varValue
Else
obj.Properties.Append obj.CreateProperty(strPropertyName, intType,
varValue)
End If
SetPropertyDAO = True

ExitHandler:
Exit Function

ErrHandler:
strErrMsg = strErrMsg & obj.Name & "." & strPropertyName & " not set to
" & varValue & ". Error " & Err.Number & " - " & Err.Description & vbCrLf
Resume ExitHandler
End Function

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"tom taol" <tom@yahoo.comwrote in message
news:44fca0fa$0$34073$815e3792@news.qwest.net...
Quote:
>
>
i want to set inputmask, comment, caption... of fields of the
table using vba.
manual work is difficult.

Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error in setting multiple field relationships with vba Andrew W answers 0 February 16th, 2006 03:35 PM
Set DefaultValue of Textbox with VBA - why doesn't it stick? deko answers 5 November 13th, 2005 08:43 AM
To create tables with VBA - To name the new table from a mask'txt box Amos answers 4 November 12th, 2005 10:35 PM
To create tables with VBA - To name the new table from a mask'txt box Amos answers 4 November 12th, 2005 10:08 PM