L
legere864
I have a main form . . . frmStudentEnrollment
I have a pop-up form . . . frmPhotoEntry
When the user wants to add a photograph to the main form, they click on a
button that opens the popup. When the popup opens the Win Open/Save window
opens to allow the user to select the photo. When the user has selected the
photo, they click a button to close the popup and save the file path to the
recordset. Here's the problem. I requery the main form just before the
popup closes. Of course the recordset goes back to the first record. I want
the user to stay with the record they were popping up from. I have seen the
other posting on this topic from 7/11/2006. I tried these solutions to no
avail. Here is my code for the button that saves the file name and closes
the popup:
Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Click
Me![txtImagePath] = Me![imgTheImage].Picture
If Validate Then
DoCmd.RunCommand acCmdSaveRecord
DoCmd.Echo False
Forms("frmStudentEnrollment").Form.Requery
DoCmd.Echo True
DoCmd.GoToRecord acDataForm, "Student Enrollment Upgrade",
[Student#] =" & [Forms]![frmPhotoEntry]![Student#]
DoCmd.Close acForm, Me.Name
End If
Exit_cmdSave_Click:
On Error Resume Next
Exit Sub
Err_cmdSave_Click:
MsgBox "Error " & Err.Number & " : " & Err.Description & " in
cmdSave_Click", vbExclamation, "Castle Admin"
Resume Exit_cmdSave_Click
End Sub
I have a pop-up form . . . frmPhotoEntry
When the user wants to add a photograph to the main form, they click on a
button that opens the popup. When the popup opens the Win Open/Save window
opens to allow the user to select the photo. When the user has selected the
photo, they click a button to close the popup and save the file path to the
recordset. Here's the problem. I requery the main form just before the
popup closes. Of course the recordset goes back to the first record. I want
the user to stay with the record they were popping up from. I have seen the
other posting on this topic from 7/11/2006. I tried these solutions to no
avail. Here is my code for the button that saves the file name and closes
the popup:
Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Click
Me![txtImagePath] = Me![imgTheImage].Picture
If Validate Then
DoCmd.RunCommand acCmdSaveRecord
DoCmd.Echo False
Forms("frmStudentEnrollment").Form.Requery
DoCmd.Echo True
DoCmd.GoToRecord acDataForm, "Student Enrollment Upgrade",
[Student#] =" & [Forms]![frmPhotoEntry]![Student#]
DoCmd.Close acForm, Me.Name
End If
Exit_cmdSave_Click:
On Error Resume Next
Exit Sub
Err_cmdSave_Click:
MsgBox "Error " & Err.Number & " : " & Err.Description & " in
cmdSave_Click", vbExclamation, "Castle Admin"
Resume Exit_cmdSave_Click
End Sub