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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How fill form fields with current record in access db

Status
Not open for further replies.

Dan01

Programmer
Jun 14, 2001
439
US
Hi, the idea is to select an individual in the database and display all current fields in form on asp webpage. The user will then modify one or more fields, then submit the form for update of fields in database. Can someone please point to examples on how this is done? Thanks, Dan.
 
Yes

assuming the database is already queried, and you have pulled the record you want. the query used is called test.. then you can create the form as follows

***********************************

<form method=&quot;post&quot; action=&quot;(page that will contain the update script)&quot;>
<input type=&quot;text&quot; name=&quot;field1&quot; value=&quot;<% =test(&quot;field1&quot;) %>&quot;>
<input type=&quot;text&quot; name=&quot;field2&quot; value=&quot;<% =test(&quot;field2&quot;) %>&quot;>
<input type=&quot;submit&quot; name=&quot;UPDATE&quot; value=&quot;Submit&quot; >
</form>

**************************************

the above will place the contents of the database into text boxes for updating, you can then set the new script to change the info in the database on the new form



hope this helps
 
Hi krappleby025, this will definitely help. Would you use a separate form to grab the record to be updated? Thanks, Dan.
 
no

say you have three pages

page 1 = search form for record
page 2 = display fields for updating
page 3 = update script

for example

page 1

<form method=&quot;post&quot; action=&quot;page2&quot;>
please enter account number to be updated :<input type=&quot;text&quot; name=&quot;criteria&quot;>
<input type=&quot;submit&quot; value=&quot;submit&quot; name=&quot;submit&quot;>

Page 2

<% dim criteria, query
(connect to database)
criteria = request.form(&quot;criteria&quot;)
query = &quot;SELECT * FROM
WHERE account=&quot; & criteria
(execute query here)
%>
<form method=&quot;post&quot; action=&quot;page3&quot;>
<input type=&quot;text&quot; name=&quot;field1&quot; value=&quot;<% =query(&quot;field1&quot;) %>&quot;>
<input type=&quot;text&quot; name=&quot;field2&quot; value=&quot;<% =query(&quot;field2&quot;) %>&quot;>
<input type=&quot;Hidden&quot; name=&quot;Account&quot; value=&quot;=&quot;<% =query(&quot;accout&quot;) %>&quot;>
<input type=&quot;submit&quot; name=&quot;UPDATE&quot; value=&quot;Submit&quot; >
</form>
<%
close database here
%>

Page 3

<%
Dim query, field1, field2, account
account = request.form(&quot;account&quot;)
field1 = requets.form(&quot;field1&quot;)
field2 = requets.form(&quot;field2&quot;)
(Open database here)
query = &quot;UPDATE
SET field1='&quot; & field1 & &quot;' and field2='&quot; & field2 & &quot;' WHERE account=&quot; & account
(execute query here)



that should do it for you, it may need slight changes, but it is the general idea, or you can place all three on one page, using hidden values to determint which part you wish to use
 
Thanks krappleby025. Looks like it's all there. I do appreciate it. Dan.
 
<td><input name=&quot;FirstName&quot; type=&quot;text&quot; value=&quot;<%=oRS(&quot;FirstName&quot;)%>&quot;></td>

This displays with part of the oRS code in the text box? Please advise krappleby025. Thanks, Dan.
 
Hi lobstah, is there a syntax error in the table detail code?: <td><input name=&quot;FirstName&quot; type=&quot;text&quot; value=&quot;<%=oRS(&quot;FirstName&quot;)%>&quot;></td>
 
looks okay, are you getting an error? if so, what does the error say?
 
Sorry lobstah the code works OK. When viewed through 1st Page 2000 development software, the asp code shows in text fields in preview mode. Code works OK when processed with IE Explorer and PWS. Thanks, Dan.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top