Re: Opening a form to a specific record
- From: "Beth" <Invalid@xxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 25 May 2006 15:14:55 GMT
Since I am opening in the form in dialog mode, it seems to cancel any record
navigation or using the find method when the form opens. As a side note,
the form has an open event that sets some default values in the form based
on the user's configuration. Those are also bypassed.
I think I could get it to all work if I didn't use the dialog form, but then
I lose the ability to "pause" the rest of the code until I close the form.
I am open to suggestions.
Beth
"Keith Wilby" <here@xxxxxxxxx> wrote in message
news:44759bc9$1_1@xxxxxxxxxxxxxxxxxxxxxxxxx
"Beth" <Invalid@xxxxxxxxxxxxxxxxxxxxx> wrote in message
news:o6gdg.33147$4L1.3828@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I have a form, frmGrades, where I input student grades. The form has a
field listing each student by id number in a limited to list combo box.
When I type a student id in the box and that student isn't in the
database, I want to capture the id I just typed, add it to the students
table, and then open my students form (frmStudents) to the newly added
student's record so I can add their name, etc.
Right now I have code that captures the value and adds the student to the
students table, and it opens the students form, but I can't get to to go
to the new student's record.
So the new record is there but you just can't navigate to it? Have you
tried using the FindRecord method? You could pass the ID number to the
form in the OpenArgs.
HTH - Keith.
www.keithwilby.com
I have the form opening modal so that when the student form is closed and
you return to the main grades form, it runs a refresh and few other steps
for validating.
Below is a sample of the code up to the steps where I return from the
student form.
Can anyone tell me what I am doing wrong?
Thanks,
Beth
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strMsg As String
strMsg = "'" & NewData & "' is not a listed student. Click yes to add
this student."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new name?") = vbNo Then
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("Students", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!StudentID = NewData
rs.Update
rs.Close
Set rs = Nothing
Set db = Nothing
DoCmd.OpenForm "frmStudents", , , "StudentID = NewData", ,
acDialog
.
- References:
- Opening a form to a specific record
- From: Beth
- Re: Opening a form to a specific record
- From: Keith Wilby
- Opening a form to a specific record
- Prev by Date: Open a Form and Move to Last Record in ADO Recordset
- Next by Date: Re: temp db
- Previous by thread: Re: Opening a form to a specific record
- Next by thread: Query form coding
- Index(es):
Relevant Pages
|