If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
requery after insert new record into a multipage form
I have a multipage form that I use to input information on students,
look up test scores, etc. I am using a popup form to add new students. On adding a new student, the code inserts a new primary ID and I insert the student's first and last name. If I want to cancel the student, I press one button which deletes the current record and closes the pop-up form. If I want to keep the student, however, I have another button which closes the pop- up and requeries my main form. Here is the code: DoCmd.Close acForm, "New Student" Dim ctlCombo As Control Set ctlCombo = Forms!Students!StudentNavigator ctlCombo.Requery Forms!Students.Requery The "New Student" is the pop-up. The first requery is for a drop-down list which I use to navigate, the second requery is supposed to requery the control of the main form "Students". However, when this requery runs, instead of staying on the first page of this 3 page form, I am redirected to the middle of the second page. I have tried to add a docmd.gotopage after the requery but to no avail. If anyone has any advice it would be greatly appreciated. On a second note, I wonder if there is a simple way to, after requerying the main form, go directly to the new student whcih was just added? Thank you, -Frank |
#2
|
|||
|
|||
requery after insert new record into a multipage form
How are the "pages" setup on yr mainform?
On a second note, I wonder if there is a simple way to, after requerying the main form, go directly to the new student whcih was just added? Here's one method navigating to newly added student assuming "StudentID" (long) is the Prim field to table "tblStudent"and we're programming in the mainform with same table as recordsource. Dim rs as DAO.Recordset set rs = me.RecordsetClone rs.FindFirst "StudentID=" & DMax("StudentID", tblStudent) if Not rs.NoMatch then me.bookmark = rs.bookmark end if Krgrds, Perry "FrankieNap" schreef in bericht ups.com... I have a multipage form that I use to input information on students, look up test scores, etc. I am using a popup form to add new students. On adding a new student, the code inserts a new primary ID and I insert the student's first and last name. If I want to cancel the student, I press one button which deletes the current record and closes the pop-up form. If I want to keep the student, however, I have another button which closes the pop- up and requeries my main form. Here is the code: DoCmd.Close acForm, "New Student" Dim ctlCombo As Control Set ctlCombo = Forms!Students!StudentNavigator ctlCombo.Requery Forms!Students.Requery The "New Student" is the pop-up. The first requery is for a drop-down list which I use to navigate, the second requery is supposed to requery the control of the main form "Students". However, when this requery runs, instead of staying on the first page of this 3 page form, I am redirected to the middle of the second page. I have tried to add a docmd.gotopage after the requery but to no avail. If anyone has any advice it would be greatly appreciated. On a second note, I wonder if there is a simple way to, after requerying the main form, go directly to the new student whcih was just added? Thank you, -Frank |
#3
|
|||
|
|||
requery after insert new record into a multipage form
The pages are simply separated by page breaks. I have buttons on the
header which you click to gotopage 1, 2, or 3. On Jan 29, 6:18 pm, "Perry" wrote: How are the "pages" setup on yr mainform? On a second note, I wonder if there is a simple way to, after requerying the main form, go directly to the new student whcih was just added?Here's one method navigating to newly added student assuming "StudentID" (long) is the Prim field to table "tblStudent"and we're programming in the mainform with same table as recordsource. Dim rs as DAO.Recordset set rs = me.RecordsetClone rs.FindFirst "StudentID=" & DMax("StudentID", tblStudent) if Not rs.NoMatch then me.bookmark = rs.bookmark end if Krgrds, Perry "FrankieNap" schreef in oglegroups.com... I have a multipage form that I use to input information on students, look up test scores, etc. I am using a popup form to add new students. On adding a new student, the code inserts a new primary ID and I insert the student's first and last name. If I want to cancel the student, I press one button which deletes the current record and closes the pop-up form. If I want to keep the student, however, I have another button which closes the pop- up and requeries my main form. Here is the code: DoCmd.Close acForm, "New Student" Dim ctlCombo As Control Set ctlCombo = Forms!Students!StudentNavigator ctlCombo.Requery Forms!Students.Requery The "New Student" is the pop-up. The first requery is for a drop-down list which I use to navigate, the second requery is supposed to requery the control of the main form "Students". However, when this requery runs, instead of staying on the first page of this 3 page form, I am redirected to the middle of the second page. I have tried to add a docmd.gotopage after the requery but to no avail. If anyone has any advice it would be greatly appreciated. On a second note, I wonder if there is a simple way to, after requerying the main form, go directly to the new student whcih was just added? Thank you, -Frank- Hide quoted text -- Show quoted text - |
Thread Tools | |
Display Modes | |
|
|