Need method to view HTML code in a table using a browser from MS Access

Hello,

I am writing code to allow automatic uploading of pages to eBay.

The code uses a table that has a memo field that my routine has populated with HTML code.  

Is there a good way that I can view the code generated from a browser before I upload it to eBay?


Currently, I need to select a cell, copy the code, paste into notepad, save a file, the navigate to the file with a browser.  There must be a better way!

Your help is appreciated!
pcalabriaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Leo AlexanderCommented:
Hello!

If your code is in the table, specifically the Memo field, you can use the Docmd export function and have that information exported to a location of your choosing. It can be done in a text or Excel format.

Also,

You may opt to create a query that reads just that field and displays the information in a preview form for you as well via a report.

Leo
0
pcalabriaAuthor Commented:
Leo,

I'm intrigued by your idea to write the query... and the preview form... can you expand on that thought?
0
Leo AlexanderCommented:
Sure--

Are you using any front-end forms or are you putting the code into a module?

I can upload a sample showing you what I am referring to, as I am not sure the written out explanation will be as beneficial... hang tight :)
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

pcalabriaAuthor Commented:
I use a front end form.
An OnClick event of a command button creates a table that includes a column called [*Description]
The  [*Description] field of tblSelectedParts contains the HTML code that I want to view.
0
Leo AlexanderCommented:
Okay, great--

What you can do is after that on click Event (i prefer to use the [Event Procedure] as it gives more flexibility with the code, have an additional directive to then display the result of that description field from the table.

All you need to do is create a query that points to the tblSelectedParts. Make sure you have a primary field, i.e. the current record and the *Description field selected in the query. If you choose not to include the primary/ID field, you will return all the records in that table--unless you don't mind this.

Next,

In the query, assuming you want to view just that particular record that you created (unless the whole table is created each time) you must create a filter. I would suggest using an append query from your form so that you can have a history of your information as opposed to creating a brand new table each time.

If you choose to do the filter method: in the criteria section of the query put this code: Forms!yourformname!fieldthathastheID

This will just return the *Description for that particular record you are viewing in the form.
IF you want all the results/no filter...just leave that part out.

Create a report based on that query..the source of that report is the query you just created.

You should be able to open the report by itself and see the content. Now, just call this report after you click your form button that is generating the data as such:

(You may need to change to [Event PRocedure] in the onclick button property)

Dim Report as String

Report = "rptNameOfMyReport

Docmd.OpenReport Report, acPreview


You can exclude the DIm and the assigning of the variable if you'd like..it just makes it easier if you need to refer to the report multiple times within the sub.


Let me know how you make out... feel free to attach your db and i can make the mods for you, if you'd like
0
pcalabriaAuthor Commented:
Leo,

Thanks.  I am making progress, but can use some help.

First, and most important, I have created a report.  Now how to I get to view the HTML code that is populated in the *Description field?

I created a recordsource of SelectedParts and a txtBox with the source of *Description.
(My thought is to get this working before I attempt to select a single record).

The text only displays in the box as text.
What I want to do is the text the way it will be displayed in a browser.

Once I get to see results, we can figure out how to display just one record.  That sounds like the easy part.
I do have a primary key in the SelectedParts table called ID.

Thanks in advance!
0
Leo AlexanderCommented:
Hi,

I may have misunderstood from what you originally wrote: Do you desire to view the HTML as the output (how it displays on the web) or as the RAW back-end code? I was under the impression you were looking for the latter, and not the output view.

Please confirm. If the former is the case, then we will need to output that result via a web browser.
0
pcalabriaAuthor Commented:
Yes, the former case.

The code that I create programmatically becomes an ebay webpage once uploaded with ebay's file exchange.
My application programmatically creates HTML code, but I have no way to view and edit it, other than saving the code to notepad, and then opening with a browser.

There's got to be a better way... rather than save the code to a temp file and then shell to explorer...
0
Leo AlexanderCommented:
I have looked in to this a lot further and it appears that (from what i've tried and found) saving a temporary file and shelling to explorer (or browser of choice is the only option)

I can suggest to have the file saved to the same location with the same name, and then run the shell to open that way:

With that, you may create the Function:

Function OpenDocument(ByVal strLink As String) As Boolean
    On Error GoTo Catch
   
    Dim objBrowser As Object

    Set objBrowser = CreateObject("InternetExplorer.application")
    objBrowser.Visible = True
    objBrowser.Navigate strLink

    Exit Function
   
Catch:
    OpenDocument3 = False
    MsgBox "Error#:  " & Err.Number & vbCrLf & vbCrLf & Err.Description
End Function


Then call it within the button in your form:

OpenDocument ("C:\text.html")


I know this isn't ideal to your desired solution, but it may be the only alternative as the html needs to be parsed somehow..i am not sure if it can be compiled while still within the access application.

Let me know your thoughts--


Leo
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pcalabriaAuthor Commented:
Thanks for the code.   I was afraid this was what I would have to do, although the though of having the HTML appear in a report was exciting... :-)

The problem with using this code is record selection, and I am wondering whether there is a feature of Access that I don't know about that will solve my problem.

I click a button which displays a query with 15 or so columns.
These columns are mostly number and short text fields that are easy to view.
The description column, however, provides no view benefit unless viewed in the browser.
 
Is there a way that I can select on row, then click a command button, and have the command button recognize the row that has been clicked?  I am wondering whether the record selector function can be used.

In other words, if I click a button called VIEW HTML, can I with VBA read the selected field?

strDescription = ????

Once I have the code loaded into strDescription the rest of the routine would be easy.

Thanks
0
pcalabriaAuthor Commented:
I'm getting an error message when the following lines of code executes:

Dim objBrowser As Object
Set objBrowser = CreateObject("InternetExplorer.application")

The error is:
-2147467259
Automation Error
Unspecifed Error

What am I doing wrong?
Do I need to set a reference?

Thanks
0
pcalabriaAuthor Commented:
I wound up doing something very similar, but you certainly gave me the idea!  Thanks
0
Leo AlexanderCommented:
Glad I could help, best of luck!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.