Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Post to Email and Database
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Post to Email and Database

 Post Reply Post Reply Page  <12
Author
288enzo View Drop Down
Groupie
Groupie
Avatar

Joined: 28 April 2003
Location: United States
Status: Offline
Points: 61
Post Options Post Options   Thanks (0) Thanks(0)   Quote 288enzo Quote  Post ReplyReply Direct Link To This Post Posted: 16 May 2003 at 12:08am
Figured it out:

objNewMail.Subject = "Thank you " & request.form("field1") & request.form("field2")

New question:

What I would like to do is put the ID in the subject. I tried objNewMail.Subject = request.form.("id") but when the email is sent the field is blank. When a new entry is saved in the database it will automatically generate a new id#, how can you pull that new id# and show it in the email? Not sure what it is that I am doing wrong here.

Thanks in advance.
Back to Top
b_bonnett View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Location: New Zealand
Status: Offline
Points: 275
Post Options Post Options   Thanks (0) Thanks(0)   Quote b_bonnett Quote  Post ReplyReply Direct Link To This Post Posted: 16 May 2003 at 4:28am
My guess would be to first add it to the database i.e.
rstResults.AddNew
...
rstResults.Update

then use intIDNumber = rstResults.Fields("ID") to get the ID number.

Hope this helps,
Blair
Webmaster, The Plane Gallery
Greetings From Christchurch
Back to Top
288enzo View Drop Down
Groupie
Groupie
Avatar

Joined: 28 April 2003
Location: United States
Status: Offline
Points: 61
Post Options Post Options   Thanks (0) Thanks(0)   Quote 288enzo Quote  Post ReplyReply Direct Link To This Post Posted: 16 May 2003 at 4:54pm

That is pretty much what I was doing.  My script is the following:

rsAddListing.Update

intIDNumber = request.form("id")

Dim objNewMail
Set objNewMail = Server.CreateObject("CDONTS.NewMail")
objNewMail.From = ********@*****.com
objNewMail.To = request.form("email")
objNewMail.Subject = "New Listing #" & intIDNumber
objNewMail.Body = "This is the body of the test email."
objNewMail.Send
Set objNewMail = Nothing

rsAddListing.Close


Set rsAddListing = Nothing
adoCon.Close
Set adoCon = Nothing

But all I get in my subject line is "Listing #"

I tried @@identity but couldn't get it to work either.  Please help - frustration starting to kick in.

Back to Top
ljamal View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Status: Offline
Points: 888
Post Options Post Options   Thanks (0) Thanks(0)   Quote ljamal Quote  Post ReplyReply Direct Link To This Post Posted: 16 May 2003 at 11:54pm
try
    intIDNuumber = sAddListing.Fields("ID")
where ID is the autonumber field for the table,
instead of
    intIDNumber = request.form("id")

Back to Top
288enzo View Drop Down
Groupie
Groupie
Avatar

Joined: 28 April 2003
Location: United States
Status: Offline
Points: 61
Post Options Post Options   Thanks (0) Thanks(0)   Quote 288enzo Quote  Post ReplyReply Direct Link To This Post Posted: 17 May 2003 at 8:37am

ljamal I tried your suggestion and got the following error:

 Microsoft VBScript runtime error '800a01a8'

Object required: 'sAddListing'

/postnewlisting.asp, line 72

Bunce, I am using MS Access 2002.  What is it that I am doing wrong?

 

Back to Top
ljamal View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Status: Offline
Points: 888
Post Options Post Options   Thanks (0) Thanks(0)   Quote ljamal Quote  Post ReplyReply Direct Link To This Post Posted: 17 May 2003 at 8:40am
Add an r to sAddListing
it should be rsAddListing
Back to Top
288enzo View Drop Down
Groupie
Groupie
Avatar

Joined: 28 April 2003
Location: United States
Status: Offline
Points: 61
Post Options Post Options   Thanks (0) Thanks(0)   Quote 288enzo Quote  Post ReplyReply Direct Link To This Post Posted: 17 May 2003 at 6:19pm
Tried you suggestion with no luck.  Thanks for trying though.
Back to Top
288enzo View Drop Down
Groupie
Groupie
Avatar

Joined: 28 April 2003
Location: United States
Status: Offline
Points: 61
Post Options Post Options   Thanks (0) Thanks(0)   Quote 288enzo Quote  Post ReplyReply Direct Link To This Post Posted: 17 May 2003 at 8:54pm

Thanks everyone, but I figured it out.  All I needed to do was add the following after my update statement.

rsAddListing.movelast

and that did it.

Back to Top
 Post Reply Post Reply Page  <12

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.