I have come across numerous methods of opening and locating a filename to have a link within the database to other files e.g. pdf docs, word docs, spreadsheets etc.
What i am trying to do is move that code into a common module that will be called from subforms or 3rd level subfroms. Its starting to do my head in.
Examples of the situation:
Student Main Form
Unbound subform which the contents change according to an option group
Option 1 Subform containing identity documents. The subform linked to a table which has a fields say identdocfilename and identdocfilepath
a subform containing two further subforms - details and list continuous
e.g. correspondence and summary of information linked together
date, who sent it, title, filename, path, summary
For various reasons can't give the real situation so those are generic ideas that match it.
Now to simplify the coding I am wanting a module that the button open file to enter the file name would call from whatever level of form it is in.
The code I've been using in a top level form is:
Private Sub btnadddoc_Click()
On Error GoTo cmdAddSmall_Err
Dim strFilter As String
Dim lngflags As Long
Dim varFileName As Variant
strFilter = "All Files (*.*)" & vbNullChar & "*.*" _
& vbNullChar & "All Files (*.*)" & vbNullChar & "*.*"
lngflags = tscFNPathMustExist Or tscFNFileMustExist _
varFileName = tsGetFileFromUser( _
strDialogTitle:="Please choose a file...")
If IsNull(varFileName) Then
Me![FilePath] = varFileName
On Error GoTo 0
MsgBox Err.Description, , "Error: " & Err.Number _
& " in file"
The code works as there is a dialogue module to support it with the standard hnd code in it.
The main issue is the subforms levels that's causing the comprehension problem or mindblock.
If someone knows where there is a tutorial or sample database I can see please put a link up.