![]() |
| |||||||
| Sponsored Links |
![]() | « Previous Thread | Next Thread » |
| | LinkBack | Thread Tools | Display Modes |
|
#1
| ||||
| ||||
| Hi All, Ok, I have the following field on my form because if the Item does not have a price (intItem is ItemCost) is not zero then I don't want to allow users to change/update the ItemDescription but it will also be a link to BOMMaster page....but if it is zero they can have a text field to input a ItemDescription, these will not have BOMMasters.... Code: <TD align=right>
<%
If intItem <> 0 then
%>
<a href="//testserver/application/BOMMaster.asp?ItemID=<%=rs("ItemID")%>" target="_blank"><%=rs("ItemDesc")%></a> </TD>
<%
else
%>
<INPUT CLASS="clrBg" type="text" name="InputItemDesc" size="30" maxlength="4" value="<%=rs("ItemDesc")%>"</TD> <%
End If
%>
</TD>
Question: I added "InputDescription" field to my tblDetails, how can I update this field from the above code? since I dont have a (Name="InputItemDesc") on the ones that do have a itemcost? Right now "Desc" (rs) is being pulled from another table (tblItem) "ItemDescription". |
| Sponsored Links |
|
#2
| ||||
| ||||
| I guess I don't understand your question. To update the field in the database just submit the form using the ItemID to identify the record and then update the data.
__________________ jmurrayhead If you agree with me... click the icon! If my post solved your problem, click the button in the lower right-hand corner of the post.Join our Folding team: DeveloperBarn Folding |
|
#3
| ||||
| ||||
| Hiya JMH, But my form has multiple items, example: The underlined ones below are the ones with a itemcost > 0 Code: Category1 -Group1 ItemDescription1-Q1-Q2-Q3-Q4-DistrictCost-ItemCost ItemDescription2-Q1-Q2-Q3-Q4-DistrictCost-ItemCost ItemDescription3-Q1-Q2-Q3-Q4-DistrictCost-ItemCost |
|
#4
| ||||
| ||||
| Each of those items should have an ID in the database. You will simply have to loop through them and run an update query using that ID to update the data. Instead of InputItemDesc, call it InputItemDescXX, where XX is the ID. Then, when the form is submit, query the database for that group to pull all of those IDs and if InputItemDescXX = the recordID AND has a data inside, update the query. For example: Code: 'The form has been submit
sql = "SELECT itemID From ItemDesc WHERE groupID = " & Request.Form("groupID")
'Create recordset and execute the query here
...
'Loop through the query
Do While Not rs.BOF And Not rs.EOF
If Len(Request.Form("InputDesc" & rs("itemID"))) > 0 Then
sql = "UPDATE ItemDesc SET ItemDesc = '" & Request.Form("InputDesc" & rs("itemID")) & "' WHERE itemID = " @ rs("itemID")
'Execute update statement
End If
rs.MoveNext
Loop
|
|
#5
| ||||
| ||||
| Ok, kind of....I think I'm still a little confused by myself dealing with the ones they can change (desc/input cost)....let me give it a try and see how it comes out....Thanks JMH!!! Will keep ya posted on the progress. |
|
#6
| ||||
| ||||
| Ok, I added something like this but just realized I have another issue....you first go in an if the intItem is 0 then you can enter a price but after I've entered a price what happens if I want to change it...it's no longer 0? Crud, have to rethink this again. ![]() Code: <TD align=right>
<%
If intItem <> 0 then
%>
<INPUT CLASS="clrBg" type="text" name="InputItemDesc<%response.write(i)%>" size="30" maxlength="4" readonly value='<%=rs("ItemDesc")%>'</TD>
<%
else
%>
<INPUT CLASS="clrBg" type="text" name="InputItemDesc<%response.write(i)%>" size="30" maxlength="4" value='<%=rs("ItemDesc")%>'</TD>
<%
End If
%>
Last edited by Rebelle; July 14th, 2008 at 09:48 AM. Reason: changed code above. |
|
#7
| ||||
| ||||
| Why are you only allowing them to change the price if it is 0? What is the difference?
__________________ "You'll never be as perfect as BLaaaaaaaaarche." |
|
#8
| ||||
| ||||
| oops...just saw your reply...was in shoutbox. i have an Item table where the item desc and cost is stored...some of those items are $0. Those are items that I need to allow to change the Item description and the cost (because desc is something like Misc.). All other items should not be changed. so since each district will have its own results, i added a details table which will hold each districts details (items/cost/qtrs, etc.) but I went back and added a location cost field and district input desc field because i need to show any ones they can change the desc/cost as what they change it to. but now since the asp code looks to see if the cost is $0....what happens if they have entered a price for a misc item and put $20, they will longer be able to change it. should my view contain both the cost from items table and district cost from details table..? would this take care of the issue above? |
|
#9
| ||||
| ||||
| So why are you doing that check in the first place? If they need to be able to edit everything...allow them to. Your logic needs to be rethought. Why even store items in the database if it doesn't have a real value? I would have a table that stores possible items. Then use that and create a relationship with another table that actually stores the data for each district. If you could script a SQL Server database for us and populate it with some values, we could probably show you a better solution. |
|
#10
| ||||
| ||||
| Hopefully i did it right.... I've attached the sql tables that I'm using. I created a view but it's not in the attached file, should i script it too? I've got the asp page setup to show all categories, groups, items then it sums each category, then a grand total at the end. just need to work on flow/edit screen (only edit items that are Misc items with $0). All others should stay as assigned in the items table because I will need to somehow show a page with all Regions/Districts combined. I'm thinking i'm going to plug in data into the details table for each districts with Null in the qtrs so they can have something to start with....then all they will be doing is editing those same records. |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Excel question | Rebelle | Microsoft Office | 11 | May 27th, 2008 07:22 PM |
| C# database question | peebman2000 | .Net Development | 19 | April 21st, 2008 03:23 PM |
| Using a field value in an IN(...) clause | richyrich | MySQL | 5 | April 13th, 2008 11:56 AM |
| Suggestions - ChangedOn field | Rebelle | ASP Development | 7 | April 8th, 2008 02:07 PM |
| Help with Updating field | Rebelle | Microsoft Access | 5 | April 1st, 2008 06:45 PM |