Error Code '-214735267 (1 Viewer)

PatAccess

Registered User.
Local time
Yesterday, 22:31
Joined
May 24, 2017
Messages
284
Hello Guys,
Here is my code:
Private Sub cmdUpCert_Click()
'Dim rs As Recordset
Dim objUpCert As Object
Dim strFile As String
Dim strFolder As String
Dim varItem As Variant

'Set rs = CurrentDb.OpenRecordset("Qry_Renew", dbOpenDynaset, dbSeeChanges)

Set objUpCert = Application.FileDialog(3)
objUpCert.allowMultiSelect = True
If objUpCert.Show Then
For Each varItem In objUpCert.SelectedItems
strFile = Dir(varItem)

strFolder = Left(varItem, Len(varItem) - Len(strFile))
MsgBox "Folder" & strFolder & vbCrLf & "File: " & strFile
ProcDocs = strFolder + strFile
Next

End If
'Set rs = Nothing
Set objUpCert = Nothing
End Sub

When I run the code the dialog box open and I choose my document but then I get Error Code '-214735267 This Recordset is not updateable.:banghead:

Can someone please help me? :(

Thank you
 

isladogs

MVP / VIP
Local time
Today, 03:31
Joined
Jan 14, 2017
Messages
18,221
Not sure why you include the recordset code as you've disabled all of it

You need to define ProcDocs as String
You are doing nothing with ProcDocs so what is the point of this code?
Multiselect code can be tricky & I'll need to check it

I suggest you replace this line
Code:
ProcDocs = strFolder + strFile

with
Code:
ProcDocs = strFolder & strFile
Debug.Print ProcDocs

Does it give the correct file path? You may need to add a backslash

Code:
ProcDocs = strFolder & "\" & strFile
Debug.Print ProcDocs
 

PatAccess

Registered User.
Local time
Yesterday, 22:31
Joined
May 24, 2017
Messages
284
I can see the file path in the Immediate window, but It does not update in the ProcDocs field and it has something to do with the Recordset not being updateable and I don't know what that intels?
 

JHB

Have been here a while
Local time
Today, 04:31
Joined
Jun 17, 2012
Messages
7,732
I suppose ProcDocs is a control name in your form, is that correct, (else explain what it is)?
Can you manually type in something in the ProcDocs or in some other controls?
If not, your form is bound to a read only query/recordset, below is a link which explain when a query is read only.
http://allenbrowne.com/ser-61.html
 

PatAccess

Registered User.
Local time
Yesterday, 22:31
Joined
May 24, 2017
Messages
284
Thanks JHB that link helped. My query uses JOINs so I used a workaround and create another table. It now works!

Thanks Guys
 

Users who are viewing this thread

Top Bottom