dim question

  • Thread starter Thread starter Rick
  • Start date Start date
R

Rick

Hi, I have a database with multiple forms, subforms and
eight tables. The database will hold over 400 records of
employee information and I am trying to reduce the work
load on the user by automating the database as much as
possible. If it isn't user friendly, the user will
discard it and go back to the dreaded Excel spreadsheet.

Here is what I am doing. I am trying to run VB off a
field After_Update function and pull data from two fields
and insert it into another field, an E-Mail address along
with a fixed E-Mail address similar to @hotmail.com.

Here is what I tried to do but I can't get passed the
Ampersand issue and I don't have the programming
experience to figure it out myself:

Dim last As String
Dim first As String
Dim mailad As String
Dim add As Long

last = Me.field1
first = Me.field2
mailad = @hotmail.com
add = first.last mailed
me.email address = add


Can someone assist this lost programmer in finding my way
back to the database?

Thanks

Rick
 
Will it work for you if you change these two lines:

mailad = @hotmail.com
add = first.last mailed

to

mailad = first & "." & last & "@hotmail.com"


I am not sure what you want to do here by using a Long Integer variable, so
cannot comment:
Dim add As Long
add = first.last mailed
me.email address = add



hth,
 
Try this:

last = Me.field1
first = Me.field2
mailad = "@hotmail.com"
add = first & "." & last & mailAd
me.email address = add

Trois Jay
www.troisj.com

Hi, I have a database with multiple forms, subforms and
eight tables. The database will hold over 400 records of
employee information and I am trying to reduce the work
load on the user by automating the database as much as
possible. If it isn't user friendly, the user will
discard it and go back to the dreaded Excel spreadsheet.

Here is what I am doing. I am trying to run VB off a
field After_Update function and pull data from two fields
and insert it into another field, an E-Mail address along
with a fixed E-Mail address similar to @hotmail.com.

Here is what I tried to do but I can't get passed the
Ampersand issue and I don't have the programming
experience to figure it out myself:

Dim last As String
Dim first As String
Dim mailad As String
Dim add As Long

last = Me.field1
first = Me.field2
mailad = @hotmail.com
add = first.last mailed
me.email address = add


Can someone assist this lost programmer in finding my way
back to the database?

Thanks

Rick
 
Hi

Use ampersand (&) to combine/concatenate multiple string variables.
last = Me.field1
first = Me.field2
mailad = @hotmail.com
add = first.last mailed
me.email address = add

add = trim(first) & trim(last) & trim(mailad)

Additionally, I would also avoid the use of recognized english words as
variable names, as you have done. Words like Name, First, Print, Go, Send
should be avoided since they may be *reserved* words in Access. Sometimes it
helps to prefix your variables with the variable type such as varName,
intCount (i.e. varName is a variable of variant type).


HTH
Immanuel Sibero
 
Perfect, you are a genius! Thank you :-)
-----Original Message-----
Will it work for you if you change these two lines:

mailad = @hotmail.com
add = first.last mailed

to

mailad = first & "." & last & "@hotmail.com"


I am not sure what you want to do here by using a Long Integer variable, so
cannot comment:




hth,

--
Cheryl Fischer
Law/Sys Associates
Houston, TX




.
 
Back
Top