Displaying data in a subform

J

Joao

I don't have Flexgrid nor Datagrid ocx. What I want to accomplish is this:
Having 3 buttons, one named Concluded and the others I don't need to explain.

When I click the Concluded button, it passes 4 arguments thru a query into a
recordset:

SQLString = "SELECT NrSubscritor, Iniciado, Concluido, Ano, Mes FROM
Processos" & _
" WHERE UserID = " & lngUserNumber & " AND Ano= " & intAno & " AND Mes=
" & intMes & " AND Despacho=YES ORDER BY TimeStamp DESC;"

Of 2 of these 4 arguments the user will must fill before running the querie.
How can I press the button and the resulting query display on a subform?

Trying to use this:

Dim Test As SubForm
Set Test.Form.Recordset = rstSQL
subfrmConcDU.SourceObject = Test

but to no avail...
 
J

Jeanette Cunningham

Joao,
a subform is inside a subform control.
So we get,

Me.SubformControlName.Form.Recordsource = strSQL

Note: the name of the subform control may be the same as the name of the
subform, or they may both have different names.


Jeanette Cunningham -- Melbourne Victoria Australia
 
J

Joao

Hello Jeanette, my subform (unbounded) is named
subfrmConcDU

Using ur code it gives me a 2467 error:
"The expression you entered refers to an object that its closed or doesn't
exist"

Me.subfrmConcDU.Form.RecordSource = strSQL
 
J

Jeanette Cunningham

Joao,
the next thing to check is the query.
Put a Debug.Print line in the code so you can check that the query does have
some records in it.

Below these lines**put the following line
Debug.Print "strsql: " & SQLString

Save and close the form.
Open the form normally and run it.
Now press Ctl + G to open the immediate window.
You will see the result for SQLString.
Copy and paste it into a new query in SQL view.
Switch the query to datasheet view to see if there are any errors with it,
if no errors, check if it returns any records.


Jeanette Cunningham -- Melbourne Victoria Australia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top