Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening forms with record from a previous form 1

Status
Not open for further replies.

randifprf

Technical User
Aug 22, 2004
11
US
I have tried a couple ways to move through forms with the current record opening in the next form and closing the previous form. Using this code:

DoCmd.OpenForm "Contacts", , , "[ContactID] = " &ContactID
DoCmd.Close acForm, "Customers"


Single forms work fine this way.
The problem is, when I open a continuous form I only show the one specific record. I would like to show that record first, but the rest of the records also.
The continuous form is used for edits and searches.
 
How are ya randifprf . . . . .
randifprf said:
[blue]The problem is, when I open a continuous form [purple]I only show the one specific record.[/purple][/blue]
If you look at the nav buttons you should see [purple]1 of 1[/purple] for single view. Its the same as you filtering one record.
randifprf said:
[blue]I [purple]would like to show that record first[/purple], but the rest of the records also.[/blue]
To do this requires an additional [blue]sorting index field[/blue] and [blue]additional code[/blue]. [purple]The record will be selected no matter where it is with the following method:[/purple]
Code:
[blue][b]Change:[/b]
   DoCmd.OpenForm "Contacts", , , "[ContactID] = " &ContactID
[b]To:[/b]
   DoCmd.OpenForm "Contacts", , , [purple][b], , , Str(ContactID)[/b][/purple][/blue]
In the OnLoad event of [blue]Contacts[/blue], copy/paste the following:
Code:
[blue]   Dim rst As DAO.Recordset
   
   Set rst = Me.RecordsetClone
   rst.FindFirst "[ContactID] = " & Val(Me.OpenArgs)
   Me.Bookmark = rst.Bookmark
   Set rst = Nothing[/blue]
[purple]Thats it . . .[/purple]

Calvin.gif
See Ya! . . . . . .
 
That works Great, just what I needed.
I have been searching for the right code for this for awhile Thanks again.
 
I use a table with a single record (in a multi-user environment two fields one for userID and the second for their selected 'working record')

This can always be tapped with a simple Dlookup or whatever to yank the current working record and filter or move to the desired record on any form in the system.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top