473,386 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Howto get Rowsource property in Access 2k db?

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
4 3180
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
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

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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Vladimir | last post by:
Hello, I have a table in MS Access database. It has one field (with BYTE datatype) that has several properties set in Lookup tab of table Design View. Display Control = Combo Box. Row Source...
3
by: Scott | last post by:
I have a function named MyFunction in a standard module that creates a semi-colon delimited list. I want to use this list for the value list in a listbox. I have the row source type property set to...
0
by: Irena | last post by:
Hi all there, Form time to time, I go back to this project of mine that drives me nuts, now. Sometimes ago, I have been suggested to use DAO insted of ADO for getting the "ROWSOURCE" property...
8
by: bbdata | last post by:
ok i have a problem here and not much time to play round. have a form bound to a table. one of the combos is bound to a field Agents. i have active and retired agents. thing is, i want to be able...
4
by: Ray Dukes | last post by:
What I am looking to do is map the implementation of interface properties and functions to an inherited method of the base class. Please see below. ...
4
by: madereal | last post by:
howdy scriptors… here’s my question: Project Background: I’m creating a database that will hold questionnaire data. Situation: I would like to set up a combobox with a changing rowsource...
2
by: Simon | last post by:
Dear reader, The syntax for the VBA code to change the RowSource of a Form is: Forms!FormName..RowSource = "TableOrQueryName"
8
by: Simon | last post by:
Dear reader, The syntax for the VBA code to change the RowSource of a Form is: Forms!FormName..RowSource = "TableOrQueryName"
11
by: Simon | last post by:
Dear reader, The syntax for the VBA code to change the RowSource of a Master Report is: Me.RowSource = "TableOrQueryName"
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.