PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > ms..win.server.scripting > ASP Access and Creating an Incremental ID for a record
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
ASP Access and Creating an Incremental ID for a record

Réponse
 
LinkBack Outils de la discussion
Vieux 03/10/2007, 12h00   #1
Corey Forman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut ASP Access and Creating an Incremental ID for a record

Alright, I might be making this more difficult than it is, but here goes:
I've currently got a script which will take the number from one field
(ticket_UserID) and a number which is randomly generated (R = CLng (10000 *
Rnd)) and takes the first 4 from the ticket_UserID and the last of the R to
make an 8 digit number. Well now, I want to do the same but not randomly
generated.

I want to add the UserID to an incremental number so I have a logical
tracking method for the tickets entered. Below is what I've got.. hope
someone can !

user_details=split(request("ticket_userid") ,"/")
rs.Open "select * from tickets where ticket_id=0" , connStr, 2, 2
rs.AddNew
rs("ticket_userID") = user_details(0)
rs("ticket_staff") = "N/A"
rs("ticket_unread") = 0
rs("ticket_origin") = "web"
user_details=split(request("ticket_userID") ,"/")
Randomize
R = CLng(10000 * Rnd)
ticketid=user_details(0) & cstr(R)
user_name=user_details(1)
  Réponse avec citation
Vieux 03/10/2007, 21h15   #2
pooradmin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ASP Access and Creating an Incremental ID for a record

On Oct 3, 7:00 am, Corey Forman
<CoreyFor...@discussions.microsoft.com> wrote:
> Alright, I might be making this more difficult than it is, but here goes:
> I've currently got a script which will take the number from one field
> (ticket_UserID) and a number which is randomly generated (R = CLng (10000 *
> Rnd)) and takes the first 4 from the ticket_UserID and the last of the R to
> make an 8 digit number. Well now, I want to do the same but not randomly
> generated.
>
> I want to add the UserID to an incremental number so I have a logical
> tracking method for the tickets entered. Below is what I've got.. hope
> someone can !
>
> user_details=split(request("ticket_userid") ,"/")
> rs.Open "select * from tickets where ticket_id=0" , connStr, 2, 2
> rs.AddNew
> rs("ticket_userID") = user_details(0)
> rs("ticket_staff") = "N/A"
> rs("ticket_unread") = 0
> rs("ticket_origin") = "web"
> user_details=split(request("ticket_userID") ,"/")
> Randomize
> R = CLng(10000 * Rnd)
> ticketid=user_details(0) & cstr(R)
> user_name=user_details(1)


Why not have the userid as it's own field, and use an autonumber for
the ticketid field in another table?


table1: (userinfo), userid, firstname, lastname, etc
table2: (ticket info) userid, ticket_userid, ticket_staff, ticket.....

you can join the two tables if need to return the results in a full
query

-J
www.pooradmin.com


  Réponse avec citation
Vieux 09/10/2007, 13h52   #3
Corey Forman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ASP Access and Creating an Incremental ID for a record

This might make more sense and simplify. I put this in a new post by mistake

I'm trying to set a variable to a call of ticket_ID from table tickets of the
most recent ID. Basically I want to call the most recent number in the column
ticket_ID and add 1000 to it to make a 4 digit #. What I've got is this:

user_details=split(request("ticket_userID") ,"/")
Q=request("ticket_id")
R = (1000 + Q)
ticketid=user_details(0) & cstr(R)
user_name=user_details(1)

This (plus more before) makes the 4 digit user ID combine with the 4 digit
number (which I need to be incremental, not random) to make an 8 digit
ticket number which makes the ticket origins easy to trace, and allows me to
keep track of the number of tickets created. Any ideas on how to make it
simple? The ticket_ID field is AutoNumbered right now so it's going up
incrementally, I just want to add 1000 to that and user that equation as R.
I'm stumped.


"pooradmin" wrote:

>
> Why not have the userid as it's own field, and use an autonumber for
> the ticketid field in another table?
>
>
> table1: (userinfo), userid, firstname, lastname, etc
> table2: (ticket info) userid, ticket_userid, ticket_staff, ticket.....
>
> you can join the two tables if need to return the results in a full
> query
>
> -J
> www.pooradmin.com
>
>
>

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 13h09.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,09806 seconds with 11 queries