Full Version: Import Html Code And Then Customize Specific Rows - Help!
UtterAccess Discussion Forums > Microsoft® Access > Access Queries
sunrun
I'm importing an html file that has 55 lines of code. I want to customize lines 5, 7, 33, 43 with variables in a table. Then recombine the file and export it as C:\\[variablename]\[variablename].html

Then loop that for however many variables I have left.

So right now I've built a form that I can copy/paste the html code into that assigns a row number (autonumber) for every line of code. Then I can just click which lines of code (yes/no box) that need to be customized and the original code I pasted into my TEMP table is appended to their appropriate tables: tbl_FileCode and tbl_FileCode_Custom

It would be relatively easy at this point to just set up a query for each custom line of code and append the custom code (along with its original row number) and uncustomized code to another TEMP table, sort ascending on the query and export it. But that just seems wasteful to have to create a query for every line of code I want to customize.

Is there a better way of doing this that someone can point me in the right direction please?

PS: I love you.

EDIT: I just realized I didn't explain the customized codes correctly. The lines of codes have variables in them from a table. So I can't just simply associate the row with the line of code. So it's like this (if this makes sense):

CODE
Row5: "<p>Howdy, " & [firstname] & "how are you?</p>"


Then all the custom lines of code and un-altered lines of code get appended to a TEMP table, sorted ascending (so all the lines of code are in order) and then exported. I'm just having a hard time structuring this with queries and may need to code up something in VB so I don't have 40million queries.
Marsupilami72
Why don´t you put some unique markers (just some text, that is used nowhere else in the file) at the desired position into your HTML-File and replace them with your variables?

There is no need to split up the HTML-File into several lines.

But anyway: creating lots of almost identical HTML-Files sounds not very elegant to me - what is the purpose of this?
sunrun
Thanks for the reply and opinion.

You can't use variables in php.ini, php5.ini and .htaccess files I don't think. At any rate, I believe I've resigned myself to coding this up in VBA for each file.
Marsupilami72
QUOTE (sunrun @ May 21 2012, 05:16 PM) *
You can't use variables in php.ini, php5.ini and .htaccess files I don't think.


You didn´t say anything about those .ini files in your initial post - so again: please describe exactly what you want to do and why you want to do it with VBA.
gary84
I do this sort of thing by,
1. Inputting the entire html file as one variable of type String.
2. Using the Replace function and other tricks to edit the content of the String.
3. Saving the string all-at-once as an html file.

> Row5: "<p>Howdy, " & [firstname] & "how are you?</p>"
No, too complicated. I would do it this way:
str1 = Replace (str1, "PlaceholderSearchText", "ReplacementText")
If there is no practical way for your input html file to have nice "PlaceholderSearchText" content, I would use some method to automatically find the target spot in the html file to insert the desired content.
Post a sample of the html file and the Table if possible.

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.