Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 6th, 2006, 11:04 PM
Registered User
 
Join Date: Aug 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Going to a specific record in a separate subform

Hi,

Here's the skinny:

I have a main form what holds a subform called "Caller Record" ([forms]![frmMain]![sbfrmCallerRecord]). I have a little code that checks when a person inputs a new "caller". If it finds a record with the same phone number the user is entering, it kicks out form ([frmPossibleMatch]} with a listbox (lstPossibleMatch) that allows the user to select the record they want work with (or ideally that's what it should do).

However, jumping from this form (frmPossibleMatch) to the appropriate record in the sbfrmCallerRecord subform is killing me. I have tried this in a variety of ways, but failed.

here's my latest attempt (this is code from the frmPossibleMatch):

    [Forms]![frmMain]![sbfrmCallerRecord].SetFocus
    [Forms]![frmMain]![sbfrmCallerRecord].Requery

    With [Forms]![frmMain]![sbfrmCallerRecord]
        DoCmd.GoToRecord , , , Me.lstPossibleMatch.Column(0)
    End With

If anyone has a suggestion, please help!

KT
 
Old August 7th, 2006, 12:11 AM
Authorized User
 
Join Date: Jul 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to lawsoncobol
Default

hi there

   well i am a newbie in VBA but still lets see ,


    If ( a-1 ) Then
       DoCmd.OpenForm "Form2"
    End If


a-1 = your condition - If it finds a record with the same phone number the user is entering - probably you should write a module or pragraph some sort of which should query from database and find possible match and if match is there then pop up the form2 by
DoCmd.OpenForm "Form2"

may be i m totally wrong ..then i m sorry i m totally new to this

Thanks and Regards
Lawson, COBOL
 
Old August 7th, 2006, 12:35 AM
Registered User
 
Join Date: Aug 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for taking a stab at it Lawson,

Your method works well for opening a form under certain conditions (i.e., a-1). Unfortunately, I'm trying to get from one open form (frmPossibleMatch), where the user has selected which record s/he wants to open, to that specific record in a separate form's subform (frmMain!sbrfmCallerRecord).

To clarify a little:

Basically, if I type in 777-888-9999 as the phone number, I get a little list box showing me other calls that were made from this number. Let's say:

Howie Smith 777-888-9999
Bert Smith 777-888-9999

The idea would be, since the user knows s/he is taking to Bert, s/he could click on Bert's name and be taken to his record in the DB.

I know how to work this if it's a form and not a subform, but I keep getting a "cannot go to specified record" with this subform in play.

Thanks,
KT





Similar Threads
Thread Thread Starter Forum Replies Last Post
double click for specific record naveed77 Beginning VB 6 0 December 4th, 2007 04:55 AM
choose specific record ar555 Dreamweaver (all versions) 12 January 12th, 2007 01:04 PM
Displaying a specific record on a webpage sswingle Classic ASP Basics 8 March 20th, 2006 12:30 AM
reference specific instances of a subform PaulH Access VBA 2 January 18th, 2005 07:23 AM
Link to a specific record rexecampbell Classic ASP Basics 2 April 7th, 2004 01:40 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.