Solved

Passing bookmark or active record to another form

Posted on 2004-10-08
8
181 Views
Last Modified: 2010-05-02
Please help:

I am having problems with a new form not being able to draw the proper information from the table.

I need the form to display the information on a record that the user had selected on a previous form.

In my current method, I have a book mark set to the proper record, and the new form would read from that record upon opening.  Unfortunately, the book mark seems to be reset every time.

I was told that this may be solved multiple ways, such as using a sub form instead of a stand alone form.

Does anyone have any suggestions?  Thanks for the help.
0
Comment
Question by:antaren
  • 2
  • 2
8 Comments
 
LVL 8

Expert Comment

by:mladenovicz
ID: 12259175
Did you pass recordset to another form?
0
 

Author Comment

by:antaren
ID: 12263570
Unsure, what method would I use to do that?
0
 
LVL 8

Accepted Solution

by:
mladenovicz earned 250 total points
ID: 12265540
Maybe I didn't understand you properly but try this,

To form (I will call it frmDisplayRecord) that should display record add this function

Public Function ShowRecord(adoRecord As ADODB.Recordset)
    Dim adoField As ADODB.Field
   
    For Each adoField In adoRecord.Fields
        Debug.Print adoField.Name, adoField.Value
    Next
End Function

On main form when you select a record call
frmDisplayRecord.ShowRecord YourRecordset

YourRecordset is positioned on the record you want to display.

HTH
0
 
LVL 3

Assisted Solution

by:Noel_Castillo
Noel_Castillo earned 250 total points
ID: 12274403
If you are opening two seperate recordsets on different form, bookmark wont work even if the two recordsets refers on the same table(in database). This is because a recordset creates its own set of bookmarks.

One way of doing this is by passing the actual recordset from the original form(display form) to the form where the user will select the record. Create a function in your in your lookup form(where record selection occurs) that accepts a recordset as its parameter.

'Create this function in the lookup form named frmLookUp
Public Function LookUp(ByRef rs as ADODB.Recordset) As Boolean
     Me.Show 1  'lookupform needs to be modal to hault until a user selects a record
     'Any movement done in the lookup form will reflect in the calling form.
End Function


'Call the function from the original form.
frmLookUp.LookUp OrigRS
'OrigRS will be set by the function (points to the row selected by the user)

:) i hope this helps
0
 
LVL 3

Expert Comment

by:Noel_Castillo
ID: 12562089
treating a form as a function as i shown above for some generic tasks is a good programming style(i think). But still its up to you on whats you're confortable using with.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now