G
Guest
I’m using Access 2003
The following code is called from a button on a userform.
The routine calls the CommonFileOpenSave box, prompting the user to search
and select a file on the network/local drive.
Once selected, the file and its path is captured in a string
(strInputFileName).
The String is then saved to a table (Con_DocPath) as a hyperlink in the
field (Subject)... this works fine!
The user can repeat the task, as the table is linked as a child of the
primary table.
My problem is that this routine will only place the string in the field
(Subject) programmatically and does not trigger the auto-number field in the
same record, as it would if one was to enter a new record manually. This is
causing broken links between my tables as the missing autonumber is not
establishing the record key and therefore the relationship.
Any ideas how this can be resolved?
Thank you, Paul
Dim strFilter As String
Dim strInputFileName As String
Dim strSQL As String
Dim str1SQL As String
strFilter = ahtAddFilterItem(strFilter, "Word Files (*.doc)", "*.doc")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select the documents associated with
this contract...", _
Flags:=ahtOFN_HIDEREADONLY)
strSQL = "INSERT INTO Con_DocPath (Subject) "
strSQL = strSQL & "VALUES ('" & strInputFileName & "');"
CurrentDb.Execute strSQL
The following code is called from a button on a userform.
The routine calls the CommonFileOpenSave box, prompting the user to search
and select a file on the network/local drive.
Once selected, the file and its path is captured in a string
(strInputFileName).
The String is then saved to a table (Con_DocPath) as a hyperlink in the
field (Subject)... this works fine!
The user can repeat the task, as the table is linked as a child of the
primary table.
My problem is that this routine will only place the string in the field
(Subject) programmatically and does not trigger the auto-number field in the
same record, as it would if one was to enter a new record manually. This is
causing broken links between my tables as the missing autonumber is not
establishing the record key and therefore the relationship.
Any ideas how this can be resolved?
Thank you, Paul
Dim strFilter As String
Dim strInputFileName As String
Dim strSQL As String
Dim str1SQL As String
strFilter = ahtAddFilterItem(strFilter, "Word Files (*.doc)", "*.doc")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select the documents associated with
this contract...", _
Flags:=ahtOFN_HIDEREADONLY)
strSQL = "INSERT INTO Con_DocPath (Subject) "
strSQL = strSQL & "VALUES ('" & strInputFileName & "');"
CurrentDb.Execute strSQL