Solved

Access VBA insert a record with html tags

Posted on 2013-11-14
4
304 Views
Last Modified: 2013-11-18
Getting an invalid syntax msg when I try to build an html tagged value string and insert it into a column.

Any suggestions for fixing this statement?  Do some of these characters require special handling?

strSQL = "Insert into [Session Detail Table] (Session) select ""<strong>"" & [Session Name] & ""</strong>"" & "" < br > "" FROM Import1"

Thanks for any suggestions
0
Comment
Question by:TOWELLR
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 10

Assisted Solution

by:Anthony Berenguel
Anthony Berenguel earned 250 total points
ID: 39648771
Try this.
strSQL = "Insert into [Session Detail Table] (Session) select " & chr(34) & "<strong>" & chr(34) & " " &  [Session Name] & " " & chr(34) & "</strong>" & chr(34) & " " & chr(34) & " < br > " & chr(34) & " FROM Import1"

Open in new window

0
 
LVL 21

Accepted Solution

by:
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 250 total points
ID: 39648961
When using " in a string you need to double them up like ""


Try this::


strSQL = "Insert into [Session Detail Table] (Session) select  ""<strong>" & [Session Name] & "</strong>< br >""  FROM Import1;"
0
 

Author Comment

by:TOWELLR
ID: 39650006
for some reason no matter how I build the insert it gives an error.
When I look at the insert statement it builds in a MsgBox it looks good.
Then it bombs with this error:

Run-time error '-2147467259 (800004005):
Method 'Execute' of object '_Connection' failed
0
 
LVL 21
ID: 39650252
Please post all the VBA code you are actually using for this task.
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
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…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
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…

728 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