Dumb_Man_Here
New Member
- Joined
- Dec 15, 2002
- Messages
- 6
Hello everyone,
I have heard allot about this site from a coworker and finally decided to give it a shot. Hopefully I will be able to explain myself properly.
I am trying to send an email out to everyone who has a chk box checked by their name. It seems to be working but till I get to the very end. I think I did not dimension a variable right and I am sure allot of other stuff too. I know this is an Excel forum but since it deals with allot of VB I thought it would be ok. The below is my crappy code:
Function email_send()
On Error GoTo email_send_Err
Dim Fxdb As Object
Dim rs As Recordset
Dim Addrs As Variant
Dim X As Object
Dim Y As Object
Set Fxdb = DBEngine.Workspaces(0).OpenDatabase("C:Documents and SettingscfennerMy DocumentsAccessFxdbfxrmgmtxp.mdb")
Set rs = Fxdb.OpenRecordset("Policy-eMailTrds")
rs.MoveFirst
While Not rs.EOF
Set Addrs = rs.Fields("email")
Set X = Addrs
Set Y = X
rs.MoveNext
Wend
MsgBox "here."
DoCmd.SendObject , , , Y, , , "Final Test", "Testing Limit Notify.", True, ""
email_send_Exit:
Exit Function
email_send_Err:
MsgBox Error$
Resume email_send_Exit
End Function
I have heard allot about this site from a coworker and finally decided to give it a shot. Hopefully I will be able to explain myself properly.
I am trying to send an email out to everyone who has a chk box checked by their name. It seems to be working but till I get to the very end. I think I did not dimension a variable right and I am sure allot of other stuff too. I know this is an Excel forum but since it deals with allot of VB I thought it would be ok. The below is my crappy code:
Function email_send()
On Error GoTo email_send_Err
Dim Fxdb As Object
Dim rs As Recordset
Dim Addrs As Variant
Dim X As Object
Dim Y As Object
Set Fxdb = DBEngine.Workspaces(0).OpenDatabase("C:Documents and SettingscfennerMy DocumentsAccessFxdbfxrmgmtxp.mdb")
Set rs = Fxdb.OpenRecordset("Policy-eMailTrds")
rs.MoveFirst
While Not rs.EOF
Set Addrs = rs.Fields("email")
Set X = Addrs
Set Y = X
rs.MoveNext
Wend
MsgBox "here."
DoCmd.SendObject , , , Y, , , "Final Test", "Testing Limit Notify.", True, ""
email_send_Exit:
Exit Function
email_send_Err:
MsgBox Error$
Resume email_send_Exit
End Function