Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Objects and Errors 1

Status
Not open for further replies.

bgreenhouse

Technical User
Feb 20, 2000
231
CA
Hi Folks

I'm trying to break up an email address into the part before the @, and the part after (the domain). I capture the email address with a form, and then input it into the variable "email" with request.form(""). However, when I then try to define a new variable called "emailsplit" as being equal to 'email.split("@")', I get this error:

Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'b.greenhouse@utoront'
/asp/get_a_card_process.asp, line 27

Here's the portion of the script in it's entirety:

Dim Fname, Lname, Address1, Address2, City, Province, Country, PCode, Phone1, Phone2, Phone3, Extension, Bday, email, PIN, PIN2, secretQ, Qanswer, PhoneLoc, emailSplit

Fname = Request.form("Fname")
Lname = Request.form("Lname")
Address1 = Request.form("Address1")
Address2 = Request.form("Apt")
Address2 = Address2 & Request.form("Address2")
City = Request.form("City")
Province = Request.form("Province")
Country = Request.form("Country")
PCode = Request.form("PCode")
Phone1 = Request.form("Phone1")
Phone2 = Request.form("Phone2")
Phone3 = Request.form("Phone3")
PhoneLoc = Request.form("PhoneLoc")
Extension = Request.form("extension")
Bday = Request.form("Day")
Bday = Bday & "/" & Request.form("Month")
Bday = Bday & "/" & Request.form("Year")
''********HERE IT IS!*********
email = Request.form("email")
emailsplit = email.split("@")
PIN = Request.form("PIN")
PIN2 = Request.form("PIN2")
secretQ = Request.form("secretQ")
Qanswer = Request.form("answer")
%>

Any suggestions would help...

Ben
 
In all VB dialects use the “Intr” function to find a character in a string

Find_AT = instr(1,TheEmailAddress,"@")
Name = Left(TheEmailAddress,Find_AT-1)
Domain = Right(TheEmailAddress, Len(TheEmailAddress) - Find_AT-1)


DougP, MCP
dposton@universal1.com

Ask me how Bar-codes can help you be more productive.
 
Thanks Doug...Very helpful. For the record though, the last line should be:

Domain = Right(TheEmailAddress, Len(TheEmailAddress) - Find_AT)

If you leave in the last "-1" it truncates the first character of the domain name.

Thanks so much!

Ben
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top