I need to move my Access 2007 project to Access 2010. Most of the coversion worked just fine, except for this bit of VBA code that I have.
This particular VBA code loads values from a PDF form, and then assigns those values to form controls. This allows the user to enter their data manually, or to have someone else (who doesn't have access to the network where the Access DB is hosted) fill out the form and have someone import it for them.
When I run the code, it gets hung up in Access 2010 on the following code:
If Title <> "" Then
Me!Title = Title
End If
The error message I get is:
Run-time error '2448':
You can't assign a value to this object.
Here is some more background code, if that helps:
Dim AcroApp As Acrobat.CAcroApp
Dim theForm As Acrobat.CAcroPDDoc
Dim jso As Object
'Declare variables by Tab used in Form view
'Tab 1
Dim Title, First_Name, Middle_Name, Last_Name, Maiden_Name As String
...
'Form Load
Set AcroApp = CreateObject("AcroExch.App")
Set theForm = CreateObject("AcroExch.PDDoc")
theForm.Open (FileName.Value)
Set jso = theForm.GetJSObject
...
'Tab 1 Data Load
Title = jso.getField("Title").Value
...
'Data Display
MsgBox "Values read from PDF:" & vbCrLf & vbCrLf & "Title:" & Title & vbCrLf & _
...
'Tab 1 Data Populate
If Title <> "" Then
Me!Title = Title
End If
In the code above, the value that I have in the form is correctly displayed in the Message box. So I know that the variable is being filled with the correct value. Also, I have the Adobe Acrobat 10.0 Type Library referenced in the VBA Editor. Again, this code worked just fine under Access 2007.
Thanks for your help.