Solved

Passing bookmark or active record to another form

Posted on 2004-10-08
8
189 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

691 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