EasyCFM.COM ColdFusion Forums / MS Access Related Issues / generating an order or confirmation number

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: generating an order or confirmation number -- page: 1 2

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

jimo
08-16-2007 @ 10:37 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 8
Joined: Jul 2006

Hello, I have a form that my users will fill out to register a class or a conference. The form works and submits data to an Access database. This is good.

When the users see the registration action page I want them to see a confirmation number. So far I have tried adding the ContactsID (auto number in Access{)field to my action page in the formfields list. I have not been able to display it and got the error message:

You tried to assign the Null value to a variable that is not a Variant data type. Sometimes I got ContactsID not defined- not sure how to define it. Can the same thing be done using and INSERT. I am new to Coldfusion, like it so far and am a coding newbie. Thank you
jim


Is there a better ways to do this?

dlackey
08-16-2007 @ 10:48 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 935
Joined: Jun 2007

I set a var to the current date and format it.  It allows me to know when the confirmation was generated, too.  And, it will always be unique, too.


<cfset ConfirmationID = "#dateformat(now(),'yymmdd')##timeformat(now(), 'hhmmss')#">


I've seen people use #createuuid()# but I wasn't pleased with that approach.

Cheers,
Chip

jimo
08-16-2007 @ 11:46 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 8
Joined: Jul 2006

Thank you for the prompt reply. I added your line of and now the message I get is VARIABLE NAME is undefined. I did not get this prior to adding the code. Does setting the ContactsID variable now mean I need to set others? Thanks

dlackey
08-16-2007 @ 12:02 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 935
Joined: Jun 2007

I used ConfirmationID in the cfset statement.  You may need to change ConfirmationID to match the variable you are calling.  The only reason why you'd should get a 'variable name undefined' is if there is a typo somewhere.

Cheers,
Chip

jimo
08-16-2007 @ 12:11 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 8
Joined: Jul 2006

I think I am going about this wrong. I added the <cfset ContactsID = "#dateformat(now(),'yymmdd')##timeformat(now(), 'hhmmss')#"> This is an auto# field in access. Do I need to change this to a date field in the database and how in Coldfusion do I specify to populate the field?  Thank you - jim

dlackey
08-16-2007 @ 12:15 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 935
Joined: Jun 2007

1)  You can have access do the work for you.  In the database, you can add now() for the default value (yes, date data type).  There is a tutorial in here somewhere; if this doesn't make sense to you, I'll find that tutorial for you.  When a value is entered,it will automatically insert the current time stamp.

OR

2) add a new column/field to use for the confirmation ID.  

Does that help?  I didn't catch you were using Access.

Cheers,
Chip

This message was edited by dlackey on 8-16-07 @ 12:16 PM

jimo
08-16-2007 @ 12:20 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 8
Joined: Jul 2006

Some Progress! I created a new confirmation number field in the database and set the variable as you instructed It worked!!! A confirmation number now displays on the action page. Thank you- Thank you.

The confirmation number field in the database is empty? Can you help me figure out how to get it included in the record in the database?
Thanks for your time.

Jim


dlackey
08-16-2007 @ 12:26 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 935
Joined: Jun 2007

Sure, you just need to define the confirmationID on the same page as your insert statement, AND include that variable (in my examples it has been confirmationID) in your insert query.



Cheers,
Chip

jimo
08-16-2007 @ 12:39 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 8
Joined: Jul 2006

IT all works! I followed the let the database do the work. Thanks for all of your help!!!

dlackey
08-16-2007 @ 1:13 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 935
Joined: Jun 2007

secret word was fungus... gross!

Anyway, jimo, you're welcome.  



Cheers,
Chip

PAGE: 1 2

Website Designed and Developed by Pablo Varando.