Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Anyone know if u can put values from a textfile back in to a form?

Status
Not open for further replies.

mijulie

Programmer
Jun 21, 2001
36
0
0
IE
I am currently inputting values into a form which then outputs results to a textfile. I'm wondering if u can recall the values from the textfile and have them populate the fields in the form. Is it possible??
 
sure -
but there's no easy way to do it.

1) Use the FSO Object to read in the file contents.
2) Depending on how it's being stored, do an InStr or RegEx for the key/value pair that you are looking for
3) get that value, store it in a variable, then output that to the form.

But - if you're storing the file as a CSV, or any other delimited file, you might be able to access it as a recordset.

See

hope this helps
leo
 
I have a separate html file written for inputting the values from the textfile (this is just the start of it!) The file name i used is valid and contains the variable being passed in to the Binary text box. When i run this however the Binary textbox contains the actual word contents. I think it could be the script commands/html tags are maybe in the wrong place. Can anyone see what the problem might be?

<HTML>
<HEAD>
<H1>SIT_TEST_CIT:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Build Validation</H1>
<SCRIPT LANGUAGE=&quot;VBSCRIPT&quot;>

sub d1_onclick
set readfile = filesys.OpenTextFile(&quot;F:\Corktest\Sit\Cit\tpota163 - pcplod - (22-05-01 ).txt&quot;, 1, false)
contents = readfile.Read(Buildform.TheBinary.Value)
readfile.close
end sub
</SCRIPT>
</HEAD>
<BODY BGCOLOR=&quot;#FFFFFF&quot;>
<FORM NAME=BuildForm>
<BR><BR>
<B>Binary:</B>
<INPUT TYPE = TEXT
Name=TheBinary Value=contents SIZE=15>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top