?
Solved

Access VBA insert a record with html tags

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
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 …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

839 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