CurrentDB.OpenRecordSet Problem (2 Viewers)

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 23:20
Joined
Aug 30, 2003
Messages
36,126
Not seeing your actual code, I'm just guessing, but you can't refer to a query value that way.
 

hturgut

Registered User.
Local time
Today, 16:20
Joined
Dec 18, 2010
Messages
24
Here is my code.Can you help how can i refer query fields?

Dim apiKey As String
Dim apiSecret As String
Dim receipientMobile As String
Dim smsMessage As String
Dim callerId As String
Dim sendtime As String
Dim contactList As String
Dim strResult As String
Dim URL_base As String
Dim str_POST As String
Dim XMLHttpRequest As XMLHTTP
Dim rst As Recordset


Set rst = CurrentDb.OpenRecordset("qryScheduledBookings(Today)", dbOpenSnapshot)
If rst.RecordCount > 0 Then
rst.MoveFirst
Do While Not rst.EOF

Set XMLHttpRequest = New MSXML2.XMLHTTP

URL_base = "http://smstech.transmitsms.com/api-wrapper/messages.multiple?"
apiKey = "mykey"
apiSecret = "mysecret"
receipientMobile = "Queries![qryScheduledBookings(Today)]![Mobile Phones]"
smsMessage = "AUTOMATIC REMINDER: Your class " & "Queries![qryScheduledBookings(Today)]![PrivateCourse_Name]" & " is scheduled at " & "Queries![qryScheduledBookings(Today)]![Booking Start Time]" & " TODAY.Please be on time. Thanks. "
callerId = "myphone"
sendtime = ""
contactList = ""

str_POST = URL_base & _
"apikey=" & apiKey & _
"&apisecret=" & apiSecret & _
"&mobile=" & receipientMobile & _
"&message=" & smsMessage & _
"&caller_id=" & callerId & _
"&sendtime=" & sendtime & _
"&contact_list=" & contactList

XMLHttpRequest.Open "GET", str_POST, False

XMLHttpRequest.Send
rst.MoveNext
Loop
End If
 

hturgut

Registered User.
Local time
Today, 16:20
Joined
Dec 18, 2010
Messages
24
Here is my code.

Dim apiKey As String
Dim apiSecret As String
Dim receipientMobile As String
Dim smsMessage As String
Dim callerId As String
Dim sendtime As String
Dim contactList As String
Dim strResult As String
Dim URL_base As String
Dim str_POST As String
Dim XMLHttpRequest As XMLHTTP
Dim rst As Recordset


Set rst = CurrentDb.OpenRecordset("qryScheduledBookings(Today)", dbOpenSnapshot)
If rst.RecordCount > 0 Then
rst.MoveFirst
Do While Not rst.EOF

Set XMLHttpRequest = New MSXML2.XMLHTTP

URL_base = "http://smstech.transmitsms.com/api-wrapper/messages.multiple?"
apiKey = "mykey"
apiSecret = "mysecret"
receipientMobile = "Queries![qryScheduledBookings(Today)]![Mobile Phones]"
smsMessage = "AUTOMATIC REMINDER: Your class " & "Queries![qryScheduledBookings(Today)]![PrivateCourse_Name]" & " is scheduled at " & "Queries![qryScheduledBookings(Today)]![Booking Start Time]" & " TODAY.Please be on time. Thanks."
callerId = "myphone"
sendtime = ""
contactList = ""

str_POST = URL_base & _
"apikey=" & apiKey & _
"&apisecret=" & apiSecret & _
"&mobile=" & receipientMobile & _
"&message=" & smsMessage & _
"&caller_id=" & callerId & _
"&sendtime=" & sendtime & _
"&contact_list=" & contactList

XMLHttpRequest.Open "GET", str_POST, False

XMLHttpRequest.Send
rst.MoveNext
Loop
End If
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 23:20
Joined
Aug 30, 2003
Messages
36,126
Since it appears you're trying to get a value from the recordset:

rst!FieldName
 

hturgut

Registered User.
Local time
Today, 16:20
Joined
Dec 18, 2010
Messages
24
Pbaldy

You saved me. It worked. Thanks a lot.
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 23:20
Joined
Aug 30, 2003
Messages
36,126
Happy to help.
 

Users who are viewing this thread

Top Bottom