Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using ACCESS properties for VB 5.0

0 views
Skip to first unread message

Bill Nguyen

unread,
Jun 1, 1998, 3:00:00 AM6/1/98
to

Is there anyway to pass ACCESS Field's properties to VB? For example,
"Caption" and "Input Mask"

Thanks


--
Bill Nguyen - bi...@jaco.com
Jaco Oil Company


Terry Kreft

unread,
Jun 2, 1998, 3:00:00 AM6/2/98
to

Hi Bill,
You can look at the properties collecton of the field object to get these,
but if they have not been created then you will get an error. Something
like the following will work

'***************** Code Start **********************
Function FieldProp(strtable As String, strField As String, _
strProp As String) As Variant

Dim lodb As Database
Dim lotab As TableDef
Dim loFld As Field
On Error GoTo FieldProp_err
Set lodb = CurrentDb
Set lotab = lodb.TableDefs(strtable)
Set loFld = lotab.Fields(strField)
FieldProp = loFld.Properties(strProp)
FieldProp_end:
Exit Function
FieldProp_err:
Select Case Err
Case 3265 'Item not found in this collection.
MsgBox "Cannot find the " & strField _
& " field or the " & strtable _
& " table", vbInformation
Case 3270 'Property not found.
MsgBox strProp & " is not a property of " _
& strField, vbInformation
Case Else
MsgBox Err & ": " & Err.Description
End Select
Resume FieldProp_end
End Function
'***************** Code End ************************

Bill Nguyen wrote in message ...

Randy Jackson

unread,
Jun 2, 1998, 3:00:00 AM6/2/98
to

You can get them but it is not documented as far as I can tell and the
properties do not show up in the autolist members or the object
browser. Therefore you'll have to know the name of the property you
want to use. I wrote a few lines of code the list the names of the
properties, some are available normally from VB and some were hidden.
For what I was doing I needed to know the number of decimal places
that had been defined in the access database. I used the following
code:

DecimalPlaces = rsTemp.Fields(i).Properties("decimalplaces").Value

You should be able to replace "decimalplaces" with the property you
need as long as you use the right name.

On Mon, 1 Jun 1998 17:20:49 -0700, "Bill Nguyen" <bi...@jaco.com>
wrote:

0 new messages