Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...You have made an incredible site which is truly a great help to me in solving problems. A tip of my hat to you!..."

Geography

Where in the world do Tek-Tips members come from?

Open form to specific record (without filter)

Ebes1099 (TechnicalUser)
3 May 12 10:25
I'm trying to open another form from a button on a different form to the matching record on the open form and have it not be filtered to just that one record. Right now I have it opening to the correct record but it's filtered to just that one record and you can't scroll left or right to get to the next record.

On my search in the new form it works great, I use a recordset to set a bookmark and when you search for a record it brings you right to it, but then you can still scroll left and right to get to the nearby records.

I want to be able to do this when I open the form. On my first form I have a field called "CodeNumber" and on the second form I have the matching field called "Code". Can I do this?
MajP (TechnicalUser)
3 May 12 10:37
are you opening the form dialog?  The reason I ask will determine how you do this.
If dialog the code execution in the calling form stops at the point you open the dialog form.  Therefore from the calling form you cannot move to the correct record.  You would have to pass the ID in the open args and have the dialog form use that in the load event.

If not dialog then the calling form can move the pop up to the correct record.
Ebes1099 (TechnicalUser)
3 May 12 10:48
Originally it was set up using a button and the "wizard" for opening a new form with a button click.

CODE

Private Sub CodeRuleOpen_Click()
On Error GoTo Err_CodeRuleOpen_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Code_Rules"
    
    stLinkCriteria = "[Code]=" & "'" & Me![CodeNumber] & "'"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_CodeRuleOpen_Click:
    Exit Sub

Err_CodeRuleOpen_Click:
    MsgBox Err.Description
    Resume Exit_CodeRuleOpen_Click
    
End Sub
MajP (TechnicalUser)
3 May 12 12:40
If using that code, then you are not opening the form dialog and you can control code execution from the calling form.  Untested, Something like

CODE


Private Sub CodeRuleOpen_Click()
On Error GoTo Err_CodeRuleOpen_Click
    Dim stDocName As String
    Dim stLinkCriteria As String
    dim rs as dao.recordset
    dim frm as access.form

    stDocName = "Code_Rules"
    stLinkCriteria = "[Code]=" & "'" & Me![CodeNumber] & "'"
    DoCmd.OpenForm stDocName
   
    set frm = forms(stDocName)
    set rs = frm.recordset
    rs.findfirst stLinkCriteria    

Exit_CodeRuleOpen_Click:
    Exit Sub

Err_CodeRuleOpen_Click:
    MsgBox Err.Description
    Resume Exit_CodeRuleOpen_Click
    
End Sub

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close