all groups > inetserver asp db > october 2007 >
You're in the

inetserver asp db

group:

Updating text box based on value from Drop down


Updating text box based on value from Drop down navin
10/29/2007 7:27:29 AM
inetserver asp db:
Hi All,

I have designed a webpage for my office and have published the site
from my system. In my webpage, I have a drop down which contains
different activities we work on, which is stored in a database. My
requirement is that, as
soon as user selects an activity, page should retrieve all the
volumes
processed by user from the databse and update a text box immediately.

Below code is what i am using in my page and this works fine and
displays the desired value in the text box when i am using the site on
my system, but does not work when any other tries to use the page and
text box remains blank:

<script language="vbscript">

Sub activityChange()
Dim conADO
Dim rsADO
Dim sqlADO
Dim ACTDATE
Dim ACTName
Dim ACT
Dim DBPath
Dim OB
Dim PreACTDate
Dim Check

FrontPage_Form1.OPBal.value=""
FrontPage_Form1.rec.value=""
FrontPage_Form1.allo.value=""
FrontPage_Form1.proc.value=""
FrontPage_Form1.VolTot.value=""

ACTDATE= FrontPage_Form1.actDT.value
'msgbox(Weekday(Cdate(ACTDATE)))
if weekday(CDate(ACTDATE))=2 then
PreACTDate=CDate(ACTDATE)-3
'msgbox(PreACTDate)
else
PreACTDate=CDate(ACTDATE)-1
'msgbox(PreACTDate)
end if

ACTNAME = FrontPage_Form1.buyers.value
ACT = FrontPage_Form1.activity.value

Set conADO= CreateObject("ADODB.Connection")
conADO.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=D:
\ACSPortal\pages\acsdata.mdb;"

Set rsADO= CreateObject("ADODB.Recordset")
sqlADO="SELECT * FROM tblEODAct WHERE actDate=" & "#" & PreACTDate &
"#" & " AND buyerName=" & "'" & ACTNAME & "'" & " AND activity=" & "'"
& ACT & "'"

rsado.Open sqlado,conado

if rsADO.EOF=true then
OB=CInt(0)
Else
OB=rsADO.Fields("actTotal").Value - rsADO.Fields("actProc").Value
End if

FrontPage_Form1.OPBal.value=OB
End Sub

Sub rec_OnBlur()
if FrontPage_Form1.rec.value="" then
msgbox("Please Enter a Value For Received or Enter 0")
'FrontPage_Form1.rec.select
end if
End Sub

Sub allo_OnBlur()
If FrontPage_Form1.allo.value = "" then
msgbox("Please Enter a Value For Allocated or Enter 0")
FrontPage_Form1.allo.select
else
FrontPage_Form1.VolTot.value=CInt(FrontPage_Form1.OPBal.value) +
CInt(FrontPage_Form1.rec.value) + CInt(FrontPage_Form1.allo.value)
end if

End Sub

Sub proc_OnBlur()
if FrontPage_Form1.proc.value="" then
msgbox("Please Enter a Value For Processed or Enter 0")
' 'FrontPage_Form1.rec.select
end if
End Sub


'Sub SubmitData_Onclick()
' If FrontPage_Form1.rec.value="" then
' msgbox("Please Enter a Value For Received or Enter 0",,"Received
Field Empty")
' FrontPage_Form1.rec.select
' Else if FrontPage_Form1.allo.value="" then
' msgbox("Please Enter a Value For Allocated or Enter 0",,"Allocated
Field Empty")
' FrontPage_Form1.allo.select
' else
' msgbox("Please Enter a Value For Processed or Enter 0",,"Processed
Field Empty")
' FrontPage_Form1.allo.select
' End if

'End Sub

</script>

Please help and let me know where i am wrong in above.

Thanks,
Navin
Re: Updating text box based on value from Drop down McKirahan
10/29/2007 1:22:27 PM
[quoted text, click to view]

[snip]

http://www.aspfaq.com/5003

AddThis Social Bookmark Button