I have inherited/been given a database to modify (someone else's work) I have noticed that having the dash - in a column named "E-mail" makes for difficulties. Whenever I try to use the data in this column in some VBA code like:
Dim db As Database
Dim rs As Recordset
Dim SQL As String
Dim E-mail As String
Set db = CurrentDb
SQL = "SELECT * FROM QRYEmail;"
Set rs = db.OpenRecordset(SQL)
rs.MoveFirst
Do While rs.EOF = False
E-mail = E-mail & rs!E-mail & ";"
rs.MoveNext
Loop
the compiler wigs out on the dash -
(it wants an 'end of statement')
is there a way to get around this?
otherwise I need a way to replace every E-Mail column heading and its occurrence in VBA code with EMail
yikes!
Dim EMail As String
...
Do While rs.EOF = False
Email = Email & rs!Email & ";"
rs.MoveNext
Loop
^ I know this code works instead and
I've seen the speedferret website. Is using their free download a good idea?
I've thought about using the Find/Replace utiliy and/or the autocorrect, I just need some expert advice before venturing further.
thanks!
jmp
Dim db As Database
Dim rs As Recordset
Dim SQL As String
Dim E-mail As String
Set db = CurrentDb
SQL = "SELECT * FROM QRYEmail;"
Set rs = db.OpenRecordset(SQL)
rs.MoveFirst
Do While rs.EOF = False
E-mail = E-mail & rs!E-mail & ";"
rs.MoveNext
Loop
the compiler wigs out on the dash -
(it wants an 'end of statement')
is there a way to get around this?
otherwise I need a way to replace every E-Mail column heading and its occurrence in VBA code with EMail
yikes!
Dim EMail As String
...
Do While rs.EOF = False
Email = Email & rs!Email & ";"
rs.MoveNext
Loop
^ I know this code works instead and
I've seen the speedferret website. Is using their free download a good idea?
I've thought about using the Find/Replace utiliy and/or the autocorrect, I just need some expert advice before venturing further.
thanks!
jmp