Hey guys how are you going?
I am in some desperate need of help, I have been working on this database for far too long and it is starting to kill me!
The problem in which I am encountering at the moment is I have a main form (called frmDataEntry) it contains a sub form (called frmImageFileSummaryList), anyway the names of these files are irrelevant, the problem is as follows:
The subform is a continous form in which the user clicks an add record button that opens a get file function. The user then selects a pdf file for example which then opens another form that contains an embedded link to the pdf and also a short name and description section to accompany this link. Once filled out the user then clicks the save record button and it is meant to save the record and return to the main form. It is saving the record and returning to the main form, however, the subform is not immediately showing the saved record, it will show, however I have to goto the next record and then once I return to the previous record the subform is showing the file/ link.
Each record is obviously going to contain different files within the subform pretaining to that particular record, hence I have created a relationship and Master/Child field links. I need the subform to immediately refresh or exhibit the saved records when it returns to the main form (frmDataEntry).
My On Click Event procedure code is as follows:
Private Sub cmdSave_Click()
' Purpose : Save the Record
' Parameters : None
On Error GoTo Err_cmdSave_Click
'If Validated, Save; if not, just return to Form
Me![txtImagePathAndFile] = Me![imgTheImage].Picture
If Validate Then
DoCmd.RunCommand acCmdSaveRecord
DoCmd.Echo False
Me.RecordSource = Me.RecordSource
DoCmd.Echo True
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, "Database Error"
Resume Exit_cmdSave_Click
End Sub
Your thoughts and help would be greatly appreciated.
Regards,
Liam