PC Review


Reply
Thread Tools Rate Thread

Data Acess via OOP

 
 
=?Utf-8?B?V2VzdGU=?=
Guest
Posts: n/a
 
      24th Apr 2006
I am attempting my 1st Access 97 application using OOP. I have an unbound
form. On the form is a button to allow users to search a table based on
TitleID. The query can return multiple records. The primary key in the
table is TrackingID. I have created a Property Let procedure for TitleID.
See code below.

Public Property Let TitleID(Value as Long)
m_TitleID = Value

Dim db as DAO.Database
Dim rs as DAO.Recordset
Dim lngCount as Long

Set db = CurrentDb()
Set rs = db.OpenRecordset("SELECT TrackingID FROM tblPositions " _
& "WHERE TitleID = " & m_TitleID & ";", dbOpenSnapshot)

rs.MoveLast
lngCount = rs.RecordCount
rs.MoveFirst
m_Array = rs.GetRows(lngCount)

rs.Close
set rs = Nothing
Set db = Nothing

End Property

The code behind the search button assigns the selected value by the user to
the object's TitleID property. The form's fields are then populated based on
the object's properties. I have navigation buttons on the form which get the
TrackingID from the array and then re-populates the form based on the new
TrackingID.

I'm not sure if this method is the most efficient? The OOP examples I have
seen extracting data from a database only pull a single record. Any comments
or alternative methods would be greatly appreciated. Thanks!

Weste


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
data acess pages not displaying data over the internet in 3-teir m =?Utf-8?B?Y2VzZW1q?= Microsoft Access 0 24th Aug 2006 04:29 AM
What problems should we expect with Acess 2003 db on aa Acess 2000 ? Will Microsoft Access 5 23rd Mar 2006 12:14 AM
How do I Upload XML data to an ACESS D/B =?Utf-8?B?Q2xpZmY=?= Microsoft Access External Data 1 25th Jan 2005 07:19 PM
Data From Excel to Acess: Overriding Access assigned data types John Faughnan Microsoft Access External Data 0 1st Jun 2004 08:38 PM
Data From Excel to Acess =?Utf-8?B?RGF2aWQgU2hhdw==?= Microsoft Access External Data 2 28th May 2004 08:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:52 PM.