» Quick Links
You can make money on these forums
We Share profits with you
Google
Google Adsense
Google Adwords
YPN
Yahoo
MSN Search
Web Directories
Web Hosting
Web Hosting Offers
Hosting News
Suggestions
Link Building
Domain Names
PHP Forums
MySQL Forums
» More Links
OSP News
Reseller Hosting
Shared Hosting
Dedicated Servers
Google Adsense
Search Engine Marketing
Link Development
Affiliate Marketing


» Advertising
Multiple DC PR Check

Free SEO Tools


Go Back   Webmaster Forums > Website Developement / Programming > ASP forums and Tips

ASP forums and Tips Talk about ASP Scripting. .net and Cold Fusion as well.

Reply
 
Thread Tools Display Modes
  #1  
Old 07-28-2006, 11:11 AM
steyn steyn is offline
Junior Member
 
Join Date: Jul 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
steyn is on a distinguished road
Default Checking value in another column....

Hi experts

I am trying to make a web-based front-end for one of our programs. I'm running into a problem. Here's a sample of one of our tables:

Code:
CaseNo ChargeCount ArrestCharge FiledCharge
123 1 13 13
123 2 14 14
199 1 03 03
The ChageCount column cannot have nulls and must be unique. is there a way when I'm adding a new charge, i can check to see if a chargecount exists? For example, if inserting a new record, it will first check if there is a chargecount, if there is not, it will make it 1. if there is a charge count, it will +1 to the existing chargecount. does that make sense?

thanks a lot in avance -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Revenue Sharing Ads ( ?):
  #2  
Old 07-28-2006, 11:13 AM
packer packer is offline
Junior Member
 
Join Date: Jul 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
packer is on a distinguished road
Default

Run select to see if a record returns

Here's the Code:
select caseNo, max(ChargeAccount) as chargeAccount from tbl_TableName where caseNo = "whatever value"
if rs.EOF and rs.BOF then
--insert the record with a chargeaccount of 1
else
--insert the record, adding 1 to rs("chargeAccount")
end if

bye for now -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
  #3  
Old 07-28-2006, 11:15 AM
algo algo is offline
OSP Starters
 
Join Date: Jul 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
algo is on a distinguished road
Default

I think you can use autonumber in access for it? Not sure but think it would work. -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
  #4  
Old 07-28-2006, 11:17 AM
salisbury salisbury is offline
OSP Starters
 
Join Date: Jun 2006
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
salisbury is on a distinguished road
Default

Quote:
Originally Posted by algo
I think you can use autonumber in access for it? Not sure but think it would work.
What algo is saying is chargeaccount has to be unique but i think he means based on the case NO because in his example you can see chargeaccount 1 2x. -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
  #5  
Old 07-28-2006, 11:19 AM
danielle danielle is offline
OSP Starters
 
Join Date: Mar 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
danielle is on a distinguished road
Default

something like this:

Code:
strSQL = "insert into tbl_TableName (caseNo, chargeaccount) values ('" & request.Form("caseNo") & "', " & rs("chargeAccount") + 1 & ")"
'this will take the chargeAccount value returned from the recordset and add 1 to it to get a new number. -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
1054 Unknown column.... Worlord MySQL Forums 1 03-09-2007 09:32 AM
Creating a column.... refik MySQL Forums 1 12-18-2006 04:44 AM
to pick column from meta table? Misael MySQL Forums 1 08-25-2006 10:19 AM
additional column added....? Kila MySQL Forums 1 08-17-2006 11:10 AM
change a value in a column in a table vladimir MySQL Forums 1 08-13-2006 10:10 AM


All times are GMT. The time now is 02:44 AM.