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!

updating an mdb field via drop down box in asp

Status
Not open for further replies.

ifeyinwa

Programmer
Mar 26, 2003
112
US
I have a table with a billno and billstatus field in access.
I have an asp page that display's the bill no, then a drop down box with 2 options to pick from eg active & nonactive. when the user picks an option from the drop down and submits , the billstatus field in the table is updated with the option picked. this is my problem
*The billstatus field in the table shows a comma before the option picked eg ,active or ,nonactive . how do I eliminate this annoying comma.
*instead of the old data in the billstatus being displayed with the new option it just adds on the new to the old .how can I get it to replace the old information with the new infor/option.

I have an asp page that display's the bill no, then a drop down box with 2 options to pick from eg active & nonactive. when the user picks an option from the drop down and submits , the hotlist field in the table is updated with the option picked. Now this is my problem:
*The hotlist field in the table shows a comma before the option picked eg ,active or ,nonactive . how do I eliminate this annoying comma so the updated field hotlist has active or nonactive without the comma.
*instead of the old data in the hotlist being displayed with the new option it just adds on the new to the old .how can I get it to replace the old information with the new infor/option.
below is what I have/what happens when i hit the submit button

StrbillNo = Trim(Request.form("billNo"))
StrHOTLIST = Trim(Request.form("HOTLIST"))


Set Conn = Server.CreateObject("ADODB.Connection")
Set RS = Server.CreateObject("ADODB.RecordSet")
Conn.Open "eiwp"
SQlstmt = "Update BILLTABLE Set "
SQLStmt = SQlstmt & "HOTLIST ='" & Replace(StrHOTLIST,"'","''") & "'"
SQLStmt = SQlstmt & "Where BILLNO = '" & StrbillNo &"'"......
 
Maybe yuour example code was truncated or something because I dont see anywhere you actually execute the nice SQL statement to do the update.

Anyway, see if you can get it working to update with a simple hard-coded SQL statement. This will make it easier to track downt he problem.
 
*The hotlist field in the table shows a comma before the option picked eg ,active or ,nonactive . how do I eliminate this annoying comma so the updated field hotlist has active or nonactive without the comma.

' Remove leading char (which is a comma).
If MyVar <> "" Then
MyVar = Right(MyVar, Len(MyVar) - 1)
End If

Best regards,
-Paul
- Freelance Web and Database Developer
- Classic ASP Design Tips
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top