Staying on a record when using multiple forms 
Author Message
 Staying on a record when using multiple forms

Hi all!

I have an application that uses the hflexgrid to list all of the company's
clients.  I want to be able to dblclick on a row and have a second form open
with just one clients info presented, but the user can navigate through the
recordset.  Right now I have everything setup fine, except that when a row
is dblclicked, the second form opens with the first record of the recordset
showing.  I need to have the clicked record show...  (I am using ADO to
create the recordset)...  Is there a flag or property that I need to set?
Any leads will be appreciated...

Quote:
>>Mark



Mon, 19 Nov 2001 03:00:00 GMT  
 Staying on a record when using multiple forms


Quote:
> Hi all!

> I have an application that uses the hflexgrid to list all of the
company's
> clients.  I want to be able to dblclick on a row and have a second
form open
> with just one clients info presented, but the user can navigate
through the
> recordset.  Right now I have everything setup fine, except that when
a row
> is dblclicked, the second form opens with the first record of the
recordset
> showing.  I need to have the clicked record show...  (I am using ADO
to
> create the recordset)...  Is there a flag or property that I need to
set?
> Any leads will be appreciated...

> >>Mark

We set up our forms as follows.  The main form has an ADO data control
that feeds the HFlexGrid.  We create 2 user-defined properties on the
second form: DataSet and DataKey.  (We are required by internal
standards to restrict the user to enter the second form in either Add,
View, or Edit mode.  So we have a third property also, called
EditMode.)  When the user selects a record from the grid, the
properties of the second form are set to the appropriate values from
the first form.  DataSet is passed the recordset behind the ADO data
control.  DataKey is passed the primary key of the selected record.  In
the form load event of the second form, do a find on your DataSet for
the DataKey, then populate the form with the information from that
record.  In your case, you could then have record navigation buttons
that scrolled through the DataSet and updated the form and DataKey for
each record.  You could also adjust the Row property of the grid on the
first form as you scrolled through the recordset to keep the grid on
the proper record.

As a side note, does anybody know of a way to move directly to the
selected record in the ADO data control's recordset when a row in the
grid is selected?  As I remember it, the DAO combo box had a property
called something along the lines of "Selected Item", that was actually
a pointer into the DAO data control's recordset.  You could then set
the DAO data control's Bookmark property to this pointer and be
directly at the selected record without having to do a find on the
recordset.  If not, is there a better way to do this?

Robert Hammett

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.



Mon, 26 Nov 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Using Access VBA to add multiple records in a loop to a table from a form

2. Multiple forms, won't stay in taskbar?

3. Need popup to stay in sync with form record

4. Link multiple datagrids to a single record (Master\Detail Form with multiple details)

5. Using multiple forms for the same table and/or multiple tables, How do you stay in the same key field?

6. How to have combo box in one form select record to be used in another form

7. CRViewer in form stays too small (do not use the hole form size)

8. Adding Multiple Records Based on Form Checkboxes

9. Multiple Records in one form

10. Multiple records on the same form

11. Display multiple records in form-view (access-like)

12. Getting at multiple related records using VBA

 

 
Powered by phpBB® Forum Software