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

Pre-populating values in forms using OnLoad sub-routine

Status
Not open for further replies.

ceeleelewis

Programmer
Sep 26, 2002
45
US
Conceptually, I think that there should be a way to use an OnLoad sub routine to pre- populate values in a check box based off the info that resides in the field.....

The question that i have is what should my sub routine look like.....


Like this example...

Sub form_OnLoad

if objRS("DNS") = yes then
[form field] DNS = &quot;yes&quot;<--(the checked value)

end if

End Sub

****************************************************
Or Like this example.


Sub form_OnLoad

if objRS(&quot;DNS&quot;) = yes then
form.value=&quot;yes&quot;

end if

End Sub


Or should I create an OnPageLoad function on a seperate ASP page that will loop thru the records on the db to check the value than add a value based off the recordset object.

Any direction in this dilemma will be greatly appreciated.

 
since you are using asp....

<% if objRS(&quot;DNS&quot;) = &quot;yes&quot; then %>
<input type=checkbox name=DNS value=yes CHECKED>
<% else %>
<input type=checkbox name=DNS value=yes>
<% end if %> -----------------------------------------------------------------
&quot;The difference between 'involvement' and 'commitment' is like an eggs-and-ham breakfast: the chicken was 'involved' - the pig was 'committed'.&quot;
- unknown

mikewolf@tst-us.com
 
I tried this, but I am not getting any results ... I have fields displaying from another table on the same form.

I look inside the db and see the results of the value.
The only difference between the two tables is the fact that fields that I want users to enter info are referencing the recordset object. (i.e.: xDNS = objRS(&quot;DNS&quot;))

I also used a response.write(objRS(&quot;DNS&quot;)) to check out what's going into the db...

Could there be an issue with my datatype or extra spaces in my text string? At first, I used checkboxes for yes/no in Access but due the constant provider errors. I swithed the datatype to text.

Again thanks for the guidance on this issue.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top