alvarogueva
Registered User.
- Local time
- Today, 04:54
- Joined
- Nov 5, 2016
- Messages
- 91
I'm not your boss, so please do not call me that!
You didn't show in which codeline you got the error!
I've look at the code in Sub btnOK_Click, and see it is a lot of junk in it, declaring variables which are not used and other stupid things, so I've cleaned it up a little.
I've noticed you are using a variable/constant "FROMPHONE", but I can't see where you've declared it and given it a value, I think that could cause the error you get.Code:Private Sub btnOK_Click() Dim db As DAO.Database Dim rs As DAO.Recordset Dim msg As String Set db = CurrentDb Set rs = db.OpenRecordset("RosterQ") If Not rs.EOF Then msg = Me.txtMessage.Value rs.MoveFirst Do While Not rs.EOF SendSMS FROMPHONE, rs![ContactNumber], msg rs.MoveNext Loop End If End Sub
So I suggest you put it in the top of the module, (remember to put in the correct value):
Also here I notice you are using variables/constants, ("ACCOUNTSID", "BASEURL" and "AUTHTOKEN", maybe more but check it your self), but I can't see where you've declared them and given them a value, so I suggest you put them in the top of the module, (remember to put in the correct value):Code:Const FROMPHONE As String = "FromPhoneNumber"
So have I been your boss, you've been in big trouble now!Code:Const ACCOUNTSID As String = "YourAccountsID" Const AUTHTOKEN As String = "YourAuthToken" Const BASEURL As String = "TheBaseURL" 'I think it is "https://api.twilio.com"
![]()
I sure would be in trouble haha.
I made all the changes, First error came here:
Run error 3265 as Item not found in this collection.
Code:
SendSMS FROMPHONE, rs![+16694004739], msg
I tried everything to try to fix it but it keeps giving me the same error.
Here is the entire code:
Code:
Private Sub btnOK_Click()
Const FROMPHONE As String = "+16694004739"
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim msg As String
Set db = CurrentDb
Set rs = db.OpenRecordset("RosterQ")
If Not rs.EOF Then
msg = Me.txtMessage.Value
rs.MoveFirst
Do While Not rs.EOF
SendSMS FROMPHONE, rs![+17868591639], msg
rs.MoveNext
Loop
End If
End Sub