[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Passing bookmark or active record to another form

Posted on 2004-10-08
8
Medium Priority
?
192 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 1000 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 1000 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
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…
Suggested Courses

649 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