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

Howto get Rowsource property in Access 2k db?

P: n/a
Hi all again,

Maybe, I'd better try to do this:

How can it programmatically get/return the "Row source" or Rowsource
property of a generic Table in a generic Access 2K database???

I found an example in VB:
me!combobox.RowSource

where "me" is the loaded form, but I am unable to apply it in ASP.
Any idea?

Many thanks.
Irena

Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
You can get at the property like this:
dbEngine(0)(0).TableDefs("Table1").Fields("Field1" ).Properties("RowSource")

However, many of us believe that combos have no place in a table, that they
should be used on forms, and only cause confusion about what Access is
really storing if you use them in a table. See:
The Evils of Lookup Fields in Tables
at:
http://www.mvps.org/access/lookupfields.htm

--
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.

"Irena" <ne******@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi all again,

Maybe, I'd better try to do this:

How can it programmatically get/return the "Row source" or Rowsource
property of a generic Table in a generic Access 2K database???

I found an example in VB:
me!combobox.RowSource

where "me" is the loaded form, but I am unable to apply it in ASP.
Any idea?

Many thanks.
Irena

Nov 13 '05 #2

P: n/a
Irena wrote:
Hi all again,

Maybe, I'd better try to do this:

How can it programmatically get/return the "Row source" or Rowsource
property of a generic Table in a generic Access 2K database???

I found an example in VB:
me!combobox.RowSource

where "me" is the loaded form, but I am unable to apply it in ASP.
Any idea?


As Allen mentioned, the only way to get at the RowSource property of a Field
is through the use of DAO (Data Access Objects), which is the data access
technology which pre-dated ADO (ActiveX Data Objects), the only data access
technology which is recommended to be used in ASP. While DAO has more
functionality and can outperform ADO when working with Jet databases*, you
should not use DAO in ASP because it is single-threaded and its use will
severely impair the performance of your website.

"RowSource" is not an inherent property of Jet database columns (fields). It
is a property that is added on by Access (you must remember that Access is
not the database: Access is a front-end tool for working with many
databases, including Jet and MSDE databases). While some of the
Access-defined properties (such as Description) have been exposed by the Jet
OLEDB provider and are accessible using ADOX (ActiveX Data Objects
eXtensions for DDL and Security), Rowsource has not been exposed, and
probably will not be, given the deprecation of the Jet components
(http://msdn.microsoft.com/library/en...asp?frame=true)

Bottom line: you will need to write your own code in ASP to replace the
"hand-holding" that was done by the Access development environment.

Bob Barrows
*DAO was designed specifically to work with Jet databases, and as such, is
more efficient in some operations than ADO, which is really a universal data
access technology.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Nov 13 '05 #3

P: n/a

Allen Browne wrote:
You can get at the property like this:
dbEngine(0)(0).TableDefs("Table1").Fields("Field1" ).Properties("RowSource")

Thanks. Could you maybe also indicate the createobject that I should
use for this. Sorry, but I am getting a bit condised with ADO, DAO etc.

However, many of us believe that combos have no place in a table, that they should be used on forms, and only cause confusion about what Access is really storing if you use them in a table. See:
The Evils of Lookup Fields in Tables
at:
http://www.mvps.org/access/lookupfields.htm

OK, but actually I have a general purpose database reader that returns
what it finds in generic mdb files created by other users in our
intranet.

Thanks a lot.
Irena

Nov 13 '05 #4

P: n/a
The function below will create the property if it does not exist, or set the
property if it does:

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

Public Function HasProperty(obj As Object, strPropName As String) As Boolean
'Purpose: Return true if the object has the property.
Dim varDummy As Variant

On Error Resume Next
varDummy = obj.Properties(strPropName)
HasProperty = (Err.Number = 0)
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.

"Irena" <ne******@hotmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...

Allen Browne wrote:
You can get at the property like this:

dbEngine(0)(0).TableDefs("Table1").Fields("Field1" ).Properties("RowSource")

Thanks. Could you maybe also indicate the createobject that I should
use for this. Sorry, but I am getting a bit condised with ADO, DAO etc.

However, many of us believe that combos have no place in a table,

that they
should be used on forms, and only cause confusion about what Access

is
really storing if you use them in a table. See:
The Evils of Lookup Fields in Tables
at:
http://www.mvps.org/access/lookupfields.htm

OK, but actually I have a general purpose database reader that returns
what it finds in generic mdb files created by other users in our
intranet.

Thanks a lot.
Irena

Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.