No nothing in a message box. I think I found a better example of what I
want
to do. I could just make a query and write the return to a web page and
that
is OK I may have to do that. But I found this:
http://support.microsoft.com/kb/266384/en-us
Near the bottom of that page you will see how to use SQL in a DAP.
Mine was this:
'sSQL = "SELECT [tblTest4].[Caption_Name] " & _
"FROM tblTest4 " & _
"WHERE ([tblTest4].[Caption_Name]) LIKE '%Rice%';"
This just hopes to find Anne Rice and other Rice's in the table
tblTest4
and
the field Caption_Name; it will also find Rice Krispies but that's
fine. I
wittled it down to just what you showed me before. The one from Microsoft
only works in Query in Access. Anyway my two list boxes one bournded
to
Caption_Name and the other bounded to Caption_Title flip through each
entry
when I activate this SQL. Trouble is I do not get a new recordset. The one
the page opens with is all that results. The rest of the code for this is:
'MSODSC.Connection.Execute sSQL
'Set rs = MSODSC.DefaultRecordset
'MSODSC.CurrentSection.DataPage.Requery
'MSODSC.CurrentSection.DataPage.MoveFirst
'rs.MoveFirst
The example from the KB article just resulted in the same recordset as the
page has when it opens.
As you can see it doesn't work for I have commented it out for another
day.
I thought MSODSC.Connection.Execute sSQL would give a new recordset but
Set
rs = MSODSC.Connection.Execite sSQL didn't do it. So I just putzed around
trying to see if I could get a new recordset from the SQL and well
nada.
That's what I am trying to do. I set up a filter that would have given me
what I want but it took too long for a 1000 recordset database. So it
needs
to work and it can't take all day.
--
George Hester
_________________________________
Quite honestly, I'm not sure that LoopCnt plays a meaningful role in this
script. The example seems to be an "old" one that has not been
updated/reviewed by MS in quite a while, and likely it was originally
written for a different purpose.
How are you wanting to use this script as a dynamic query? Where are you
putting the results from the opened recordset (I assume that you're
not
wanting to just display them in a MsgBox popup?)?
--
Ken Snell
<MS ACCESS MVP>
Ah that makes a little more sense thanks Ken. Now for the counter
LoopCnt.
Doesn't that need to be incremented somewhere or is that native to
customers.htm somewhere? I don't have that html. Do you think you could
send
that to me? I don't need the accompanying data. I just need the source
code
to see how they are using it. Thanks.
--
George Hester
_________________________________
message
Looks like a typo in the script to me.
Try this script instead (I have replaced strRecordsetDef with rsDef):
Dim rs
Dim rsDef
Dim LoopCnt
LoopCnt = 0
rsDef = MSODSC.RecordsetDefs.Item(0).Name
Set Rs = MSODSC.Execute(rsDef)
Rs.MoveFirst
MsgBox "Company: " & Rs("CompanyName") & vbNewLine & "Contact: "
&
Rs("ContactName") & _
vbNewLine & "Phone: " & Rs("Phone")
Set Rs = Nothing
--
Ken Snell
<MS ACCESS MVP>
http://support.microsoft.com/kb/304724
I just cannot seem to verify the argument of the MSODSC.Execute
command
nor
can I determine what is happening with LoopCnt. Can anyone shed some
light
on this script besides the fact that Microsoft wishes DAP would die
gracefully? Thanks.
What I am doing is trying to make a "dynamic" query in a DAP
page.
And
something tells me I do this with a Server filter and RecordsetDef.