opening a subform to a specific record?

Hey y'all, I've got a form that lists all the Students in a class and
a link to "Edit Student Information" which opens a form to edit
individual records.  The link uses the same type of code generated by
the form wizard and it automatically filters the records to the class.

The next thing I want to do is to open the new form to exactly the
record that was highlighted in the list.  I can capture the list
position from the subform (SelTop) and I found a method called
"GoToRecord" that works like this to go to the 8th record:

DoCmd.GoToRecord acDataForm, "Student Data Entry", acGoTo, 8

But, one, it doesn't seem to work, and two, the records on the pop-up
form might be sorted differently so I'd rather search by value.  Is
there a way I can activate "Find" on the new form?  I don't want to
apply a filter because the other students in the class should still be
accessible.

0
Joe
3/19/2007 3:27:21 PM
access.formscoding 7493 articles. 0 followers. Follow

1 Replies
911 Views

Similar Articles

[PageSpeed] 58

Hi Joe,

on the Load event of [Edit Student Information]
'~~~~~~~~~~~~~~

    'set up Error Handler
    On Error GoTo Proc_Err

    'see if StudentList form is open
    if not currentproject.allforms("StudentList_formname").IsLoaded then
       exit sub
    end if

    dim f as form

    set f = forms("StudentList_formname")

    'save current record if changes were made
    If f.dirty then f.dirty = false

    'exit if user is not on a current record in that form
    if f.NewRecord then exit sub

    'declare a variable to hold the primary key value to look up
    Dim mRecordID As Long

    'set value to look up by what is selected
    mRecordID = f.StudentID_controlname

    'find the first value that matches
    Me.RecordsetClone.FindFirst "StudentID_fieldname= " & mRecordID

    'if a matching record was found, then move to it
    If Not Me.RecordsetClone.NoMatch Then
       Me.Bookmark = Me.RecordsetClone.Bookmark
    End If

Proc_Exit:
    Exit Sub

Proc_Err:
    MsgBox Err.Description, , _
         "ERROR " & Err.Number _
         & "   ProcedureName"

    'press F8 to step through code and debug
    'remove next line after debugged
    Stop:    Resume

    Resume Proc_Exit

'~~~~~~~~~~~~~~`

WHERE
-ProcedureName is the name of the procedure that the code is in 
(Form_Load) so if there is an error, you can see where it is




Warm Regards,
Crystal
  *
      (:  have an awesome day  :)
   *
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
   *



Joe Clark wrote:
> Hey y'all, I've got a form that lists all the Students in a class and
> a link to "Edit Student Information" which opens a form to edit
> individual records.  The link uses the same type of code generated by
> the form wizard and it automatically filters the records to the class.
> 
> The next thing I want to do is to open the new form to exactly the
> record that was highlighted in the list.  I can capture the list
> position from the subform (SelTop) and I found a method called
> "GoToRecord" that works like this to go to the 8th record:
> 
> DoCmd.GoToRecord acDataForm, "Student Data Entry", acGoTo, 8
> 
> But, one, it doesn't seem to work, and two, the records on the pop-up
> form might be sorted differently so I'd rather search by value.  Is
> there a way I can activate "Find" on the new form?  I don't want to
> apply a filter because the other students in the class should still be
> accessible.
> 
0
strive4peace
3/19/2007 10:19:54 PM
Reply:

Similar Artilces:

After sharepoint3 import from sp2, DNS records incorret?
Hello We have imported site to Sharepoint 3.0 (SBS2008) from Sharepoint 2. Now there are some strange occasional DNS lookup errors. Some pages fail to open but next time there is no problem opening the same page. DNS is running on the same local server where Sharepoint. Both have the same IP in fact.. With nslookup from workstation I noticed that "mycompanyweb" is resolved correctly while "http:/mycomanyweb" fails. 1. Might there be some (http:// prefix) missing in DNS server? 2. When there is a subsite "mycompanyweb/mydepartment", do we need ...

when i open an attachment it just shows a box i cannot open
Attachment, whether docs or pictures won't open. I can preview them inside the window pane, but then have to copy to word doc to print. Should be able to open attachment and then print just from there. Please help. It's like the Microsoft Picture manager is working strangely. ...

code to allow edits in form AND subform
Ok, here goes............. I have a form (frmBOL) which contains a subform (sfrmData). I have this code working to allow the form to be edited, but I can't seem to incorporate the subform into it. Everything I try gives me an error. Can anyone help? Private Sub cmdOK_Click() Dim sPassword As String sPassword = Nz(Me.txtPassword.Value, "") ' if it is a valid password, we let them edit the ' form that called this form. The calling form is ' responsible for check that the current user is ' either the QA tech on the record, or a me...

Skip Records in a Form
I have a form in my database based on a table. The table is appended with new reocrds everyday. My goal is to have the form present only the new records and allow a user to key data into the new record and be recorded in the same table. The issue I have is that the form is displaying all records not just the new. Does anyone know a way to open a form and display only those records that have not been updated by the user? Thanks in advance Add a column for UpdateDate and update this column whenever a record is updated via the form. Set up a query to read all the rows/columns ...

Dumb question about tabs or tabs with subforms
First of all, thanks for reading this post. I have one table with lots of fields in it. The field I'm concerned with this post is [shift]. I've created filters which will filter out Day Shift or Night Shift. I've created a tabbed formed with two subforms with the exact same info except they are Tab 1 is Day Shift. Tab 2 is Night Shift and filtered accordingly. So that means twice the programming. For example if I have to change one item in tab 1 subform then I'd also have to change it in tab 2 subform. The dumb question is which would be more efficient putting all the...

Opening a paramater form when open a report
I have a repor that takes date parameters from a seperate form.. As it is now I have to open the form put in the paramaters and then run the report which is based on a query... I would like to have the form pop up when I open the report and then close once once the report has run.. Help Please And thanks in advance bob On Wed, 15 Aug 2007 11:56:00 -0700, Bob wrote: > I have a repor that takes date parameters from a seperate form.. As it is now > I have to open the form put in the paramaters and then run the report which > is based on a query... > > I would like to ...

How do I get my MS Pub 2000 to open Pub files from Pub 2003?
i cannot get my Publisher 2000 to open files from Pub 2003....do i have to buy Pub 2003? or is there a solution that I can download? I have already disabled my antivirus and that didn't do anything.. also my files are not "read only". pls help. thx. Novice Novice <Novice@discussions.microsoft.com> was very recently heard to utter: > i cannot get my Publisher 2000 to open files from Pub 2003....do i > have to buy Pub 2003? or is there a solution that I can download? I > have already disabled my antivirus and that didn't do anything.. also > my files ...

Publisher 2000
After I open the Publisher 2000 program and attempt to open a file or create a new document, I get the message "Microsoft Publisher 2000 Version 6.0 has encoountered a problem and needs to close. WE are sorry for the inconvenience". I tried repairing the program and even reinstalling it, but that did not correct it. Suggestions? If you are trying to use Publisher on a network - don't it is not intended for a network Publisher files have to be worked on and saved to the local hard drive ONLY. -- Hi tom (tevanz@bellsouth.net), in the Microsoft� newsgroups you posted: ...

opening links in outlook
why i can not open links attached to my e-mails mike wrote: >why i can not open links attached to my e-mails > I think you did some mistake in typing so just do one thing first type the link in notepad and then direct copy and paste that in your mail. -- Stellar Information Systems Ltd. D18, Sector-33, Infocity Phase II, Gurgaon-122001 Phone : (0124) 326 6069, 432 6700 Website : http://www.stellarinfo.co.in/ What happens when you try? Do you get the error; "This operation has been cancelled due to restrictions in effect on this computer" See http://www.m...

Restarting Record Count in a Query
Hello, I have a query that returns these results for me: Badge No DepLastName DepFirstName 11111 Smith Mary 11111 Smith Joe 22222 Brown Bill 22222 Brown Mary 22222 Brown Jack I need to count the dependents that are linked to each Badge No so my results look like this Badge No Count DepLastName DepFirstName 11111 1 Smith Mary 11111 2 Smith Joe 22222 1 Brown Bill 22222 2 ...

Problem trying to open old money file
Hi, I am trying to open a four-month old money file, which was on my backup disk. It is a *.mny file, not a backup file. It was created using the same version of Money (2005) which I still use. When I start MS MONEY and try open my old data file, it tells my that it wants convert my file so it works with this version. (Not sure why as the file was created in this version of MS Money). Then when I try and carry out the conversion it gives the following error message. "Money cannot locate xxxx or cannot open it, possibly because it is a read-only file or you do not have...

Running Virus Scan Slowing down opening files
3 minutes to open files in excel and word Are you using kaspersky virusscan? It is know for it. If yes please ask you administrator to exclude scan on harddisk or network files in the settings. -- Arien ------------------------------------------------------------------------ Arien's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1892 View this thread: http://www.excelforum.com/showthread.php?threadid=390878 All Virus Scanning can be stopped: If your using Norton Follow the below if you want to open documents much faster Open Norton Click on: Norton Interne...

subform datasheet: one field does not show the values
I had created a subform for order details and linked this to orders form\ table by OrderId. All the details are showing up in my subform( datasheet view) except OrderNO, which is a text field. I am using Access 2007. Do any one of you experienced this kind of issue before? Thanks -- Message posted via http://www.accessmonster.com On Thu, 18 Mar 2010 15:47:54 GMT, "mls via AccessMonster.com" <u55943@uwe> wrote: >I had created a subform for order details and linked this to orders form\ >table by OrderId. All the details are showing up in my subform( data...

Email with tiny attachments open slow
Good Day All, I am using Exchange server 200 and Outlook 2003 mail client. I have started to experience with a single machine where all of a sudden reading emails with attachments of any size, even 6k, slows greatly. Just selecting the email item in the list takes at least 30 seconds before the lower pane shows the body of the selected item. No other client has the same problem even while this machine does. The problem seems to disappear at some point and then returns. The machine was connected to a 10Mbps switch so I changed to a 100Mbps switch and Event logs reveal nothing. I have ...

Need an open house sign in sheet
Need an open house sign in sheet That's interesting, but do you have a question about Publisher? -- James Bart: "According to creationism, there were no cavemen." Homer: "Well good riddance, their drawings sucked and they all looked like hippies!" "soozeeque" <soozeeque@discussions.microsoft.com> wrote in message news:1096B15B-9766-4573-9FC2-2053BEC1F34B@microsoft.com... > Need an open house sign in sheet I would suggest keeping it simple. Use a table for the visitors' information and maybe your real estate company's logo...

recording asset loan extra payments
How do I record and track an asset loan in Money 2002 when an extra payment amount is given(each month, our land payment check is for $1.02 more than it should be.) You create a loan account and setup a loan payment. Then you edit the splits of the loan payment and add a line for an extra Principal Transfer (that's the "category") of the $1.02. "Katy" <db0008@dragonbbs.com> wrote in message news:092701c38f72$1f31ffc0$a001280a@phx.gbl... > How do I record and track an asset loan in Money 2002 > when an extra payment amount is given(each month, our > l...

opening links
Whenever I try to open a link in Outlook XP -- (Win XP Pro) it opens a "open with" prompt/box. Point it to the .exe for your preferred browser and click okay. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the Swen virus, all e-mails sent to my actual account will be deleted w/out reading. After searching google.groups.com and finding no answer anonymous@discussions.microsoft.com <anonymous@discussions.microsoft.com> asked: | Whenever I try to open a link in Outlook XP -- (Win XP | Pro) it opens a "open with&quo...

cannot open excel file from outlook
Excel 2007 cannot open document eithout first saving and opening thru excel Try to re-register Excel. Close Excel first and On the Windows Taskbar Start>Run "excel.exe /regserver"(no quotes)>OK. See the space between exe and /regserver You might have to designate a full path to excel.exe. In that case Start>Run "C:\yourpath\excel.exe" /regserver(quotes required)>OK Gord Dibben MS Excel MVP On Wed, 27 Jan 2010 11:38:12 -0800, Rick <Rick@discussions.microsoft.com> wrote: >Excel 2007 cannot open document eithout first savi...

If record Does Not Exist?
Hi I have a form in which i have two Text Fields name "TxtAccountNo" And "TxtPartyName". When a user enters the Account No. in text field, the form automatically pull the Party Name from the table "TblParties" Now i want that if the user enteres an Account no. that doesnot exist in "TblParties", then a msgbox must appear with a message. Thank you -- Message posted via http://www.accessmonster.com Are you using a combobox to pull the Party Name? If not, how? What is the code you are using? If in a combobox you can add a Not In Li...

Truncate field starting with location of specific characters
Hi, I need to truncate a field once a couple of special characters are found. For example, if the field stores people's names and if I find two consecutive dashes anywhere in the field (searching from left to right), I want to clear the contents of the field starting with the two dashes. Anything preceding the two dashes in the field will need to be preserved. Thanks! In VBA, it would be something like: Dim lngDashes As Long lngDashes = InStr(Me.Textbox1, "--") If lngDashes > 0 Then Me.Textbox1 = Left(Me.Textbox1, lngDashes - 1) End If In a query, it w...

unable to open your default mail folders...
I am running XP Pro and Office XP 2002. I currently use Outlook express on this PC but want to switch over to Outlook. When I try to open Outlook I get the message- Unable to open your default mail folders. Could not open item. Try again. Any ideas what's going on ??? Thanks in advance!!! -- Dennis Have you created a mail profile and installed your mail account(s)? -- Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. ALWAYS post your Outlook version. How to ask a question: http://support.microsoft.com/KB/555375 After furious head scrat...

Workbook always opens at a specific sheet and cell
I have a workbook consisting of many sheets. How do I make sure that everytime I open the work book, it would directly point to a specific sheet and cell? Hi put the following code in your workbook module (not in a standard module). sub workbook_open() me.worksheets("sheetx").activate end sub -- Regards Frank Kabel Frankfurt, Germany Zee wrote: > I have a workbook consisting of many sheets. How do I make sure that > everytime I open the work book, it would directly point to a specific > sheet and cell? methinks the original poster also wanted to activate a particu...

EXCEL Files open Slow
Why is it that when I open associated files for Office 2007 (.xlsx and ..docx) that they open SLOW (approx 15 seconds). However, if I have Excel or Word open and then attempt to open specific files, they open in a snap ? I have Office 2007, Vista Home Prsmium, a 2.4 Quad Core system, and four gigs of ram. Can someone please explain this and help me out ? Thanks. Hi, If I get your point - when you open the files in the Window Explorer (outside of Excel) it takes longer. Sometimes that if because Excel needs to launch, and that can be slower than just opening a file from inside of Excel...

Modify report to print individual group of records on separate pag
I am new to report writer and I am trying to figure out how to print individual employees records separately. It is an employee training records report where it group all of an employees training classes together. However, unless it fills the page, the next person's records are printed and I'm trying to start each new group on a new page. I don't know where to find the group properties. Please help. Amytdev. I think you need to create an additional footer. The additional footer can have the "Page Break" option set, causing a new page to be started. Below is the p...

Opening a second mdb file from an open mdb file
I have two mdb files (one used for general department use and the other for detailed reporting). For ease of maintenance, I'd like to keep these mdb files separate, but I would like to have the ability to open the second mdb file from the general dept Access program. Is there an exisitng macro or VBA code I could use to accomplish this task? Thanks for your help. Sure, you can easily just shell out to another app: http://www.mvps.org/access/api/api0018.htm or even create a hyperlink that opens the file. Just create a label, go to the property sheet and enter a path in the hype...