By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,665 Members | 1,912 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,665 IT Pros & Developers. It's quick & easy.

table setting with vba

P: 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 ***
Sep 4 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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" <to*@yahoo.comwrote in message
news:44***********************@news.qwest.net...
>

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

Sep 5 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.