Blueice13085
asked on
MS Access code help
here is the code i have that i need some help with. i want to open a word doc using on click, but i want the path to be stored in a table for change purposes
the above code give me a run-time error 13 type mismatch in the table u see the Dlookup the field TowAwayFormlocation=C:\Qui ck Logs\Data\Forms\TowAwayFor m.doc
if i use this code below it works fine.
Dim oApp As Object
Dim strDocName As String
strDocName = [b]DLookup("TowAwayFormLocation", "tblCompanyInformation", "CompanyID" = 1)[/b]
Set oApp = CreateObject("Word.Application")
oApp.Visible = True
oApp.Documents.Open strDocName
the above code give me a run-time error 13 type mismatch in the table u see the Dlookup the field TowAwayFormlocation=C:\Qui
if i use this code below it works fine.
Dim oApp As Object
Dim strDocName As String
strDocName = C:\Quick Logs\Data\Forms\TowAwayForm = " & ".doc"
Set oApp = CreateObject("Word.Application")
oApp.Visible = True
oApp.Documents.Open strDocName
I mean:
try change:
strDocName =
to:
strDocName = DLookup("TowAwayFormLocati on", "tblCompanyInformation", "CompanyID" = 1)
try change:
strDocName =
[b]DLookup("TowAwayFormLocation", "tblCompanyInformation", "CompanyID" = 1)[/b]
to:
strDocName = DLookup("TowAwayFormLocati
ASKER
ops the [ / b ]was not ment to be there i was trying to make it bold what i had was
strDocName = DLookup("TowAwayFormLocati on", "tblCompanyInformation", "CompanyID" = 1)
strDocName = DLookup("TowAwayFormLocati
ASKER
this works fine
strDocName = "C:\Quick Logs\Data\Forms\TowAwayFor m.doc"
but again i want that to be in the table! so it could be changed location
strDocName = "C:\Quick Logs\Data\Forms\TowAwayFor
but again i want that to be in the table! so it could be changed location
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Figured out on my own, but thanks for the help
strDocName = DLookup("TowAwayFormLocati
to:
strDocName = DLookup("TowAwayFormLocati