[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

MS Access code help

Posted on 2011-03-20
6
Medium Priority
?
282 Views
Last Modified: 2012-05-11
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

   
 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

Open in new window


the above code give me a run-time error 13 type mismatch in the table u see the Dlookup the field TowAwayFormlocation=C:\Quick Logs\Data\Forms\TowAwayForm.doc

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

Open in new window

0
Comment
Question by:Blueice13085
  • 4
  • 2
6 Comments
 
LVL 54

Expert Comment

by:Ryan Chong
ID: 35177628
try change:

strDocName = DLookup("TowAwayFormLocation", "tblCompanyInformation", "CompanyID" = 1)


to:

strDocName = DLookup("TowAwayFormLocation", "tblCompanyInformation", "CompanyID" = 1)
0
 
LVL 54

Expert Comment

by:Ryan Chong
ID: 35177630
I mean:

try change:

strDocName =
[b]DLookup("TowAwayFormLocation", "tblCompanyInformation", "CompanyID" = 1)[/b]

Open in new window



to:

strDocName = DLookup("TowAwayFormLocation", "tblCompanyInformation", "CompanyID" = 1)
0
 

Author Comment

by:Blueice13085
ID: 35177647
ops the [ / b ]was not ment to be there i was trying to make it bold what i had was


strDocName = DLookup("TowAwayFormLocation", "tblCompanyInformation", "CompanyID" = 1)
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 

Author Comment

by:Blueice13085
ID: 35177650
this works fine
strDocName = "C:\Quick Logs\Data\Forms\TowAwayForm.doc"

but again i want that to be in the table! so it could be changed location
0
 

Accepted Solution

by:
Blueice13085 earned 0 total points
ID: 35177667
Dim oApp As Object
    Dim strDocName As String
   
   strDocName = DLookup("TowAwayFormLocation", "tblCompanyInformation", "[CompanyID] = 1")
   
   Set oApp = CreateObject("Word.Application")
   oApp.Visible = True
   oApp.Documents.Open strDocName

Open in new window


this works, but thanks for the help
0
 

Author Closing Comment

by:Blueice13085
ID: 35213345
Figured out on my own, but thanks for the help
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

865 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question