I am working on a DB that links users to training videos.
The primary Form "2_CCC" has the Windows media player plugin. That works.
The Subform has all the video files.
The issue is that I can't pass the address from the Subform to the media player. The address is stored in a TextBox called "Video."
Public Sub PlaybButton_Click()
Dim videoaddress As String
videoaddress = Forms![2_CCC]![2_CCC_Subform].Form![Video]
Forms![2_CCC]!WMP.URL = videoaddress
End Sub
I get
Automation error.
I redid the code:
Public Sub PlaybButton_Click()
Forms![2_CCC]!WMP.URL = Forms![2_CCC]![2_CCC_Subform].Form![Video]
End Sub
If I put the file path directly in the code, it works.
I thought it might be an issue with not passing into the primary Form.
I added a TextBox to the primary form called "VideoSelect"
Public Sub PlaybButton_Click()
Dim videoaddress As String
videoaddress = Forms![2_CCC]![2_CCC_Subform].Form![Video]
Forms![2_CCC]!WMP.URL = videoaddress
End Sub
I get a new error
You entered an expression that has an invalid reference to the property.
I did a MsgBox to see what VideoSelect displays, and it is showing the correct file address.
So the issue is that the quotation marks from the file pathway were causing an issue with the WMP player.
So I just added a step to remove those.
The code is now quite simple and works 100% of the time.
Forms![2_CCC}!WMP.URL = Replace(Forms![2_CCC]![2_CCC_Subform].Form![Video],"""","")