Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Access VBA insert a record with html tags

Posted on 2013-11-14
4
Medium Priority
?
307 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 1000 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 1000 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

609 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