Desperatly need help with Access!

T

TheGerman

Hello,

I hope somone can help me solve this problem!

I need to fill an array with Data from a Report!


For i = 1 To Report_UpdateReport.Count

myarray(i) = ?

Next i

How do i fill the array with the information? People suggest me to use the
..EOF command but access dosn't seem to find that command.
I would highly appriciate it if you could help me fill this array. The
field in my report i want is called "parentid" and the reports anme is
UpdateReport

Thank you very much!

~Daniel
 
K

Ken Snell [MVP]

You've posted this question in many newsgroups. .... one is usually
sufficient.

You cannot get data from a report... but you can get data from a query that
is the record source of a report.

Can you tell us many more details, please, about what you want to
accomplish.
 
T

TheGerman

I really need an answer and i am just having no luck anywhere with anyone!

I am using a Query which complies a lot of tables and information from there
i use the following to filter my answers for the report when pressing a
button on a form:

strReportName = "UpdateReport"
strCriteria = "[Assemblies_ComponentID] = '" & ComponentID.Value & "'"
DoCmd.OpenReport strReportName, acViewPreview

From there i have my report which gives me the different parentId there are
several of them that i pull and i want to open another report for each of
them. Example:

I run the updateReport which has 15 parent id's in it and i extract those
into an array and throught hat i can use them to open other reports and
manipulate the data even more

So if i have:
Dim parentarray()

redim parentarray(Report_UpdateReport.Count )

For i = 1 To Report_UpdateReport.Count
parentarray(i - 1) = ?????
MsgBox parentarray(i - 1)
Next i

I need to get the ?? part figured out.

Serveral people suggest using .eof and such but my access just won't do it
for some reason. I am using 2003

~Daniel
 
K

Ken Snell [MVP]

The reason people have suggested that you would use the .EOF property is
that they are assuming that you are opening a recordset based on the same
query that the report is using, and that you're looping through that
recordset to read the values from each record.

I'm sorry, but I'm just not following what you want to do specifically.

Generically, you open a recordset and loop through it:

Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("QueryOrTableOrSQLStatement", dbOpenDynaset)
If rst.EOF = False And rst.BOF = False Then
rst.MoveFirst
Do While rst.EOF = False
MyValue = rst.Fields("FieldName").Value
rst.MoveNext
Loop
End If
rst.Close
Set rst = Nothing
dbs.Close
Set dbs = Nothing


--

Ken Snell
<MS ACCESS MVP>

TheGerman said:
I really need an answer and i am just having no luck anywhere with anyone!

I am using a Query which complies a lot of tables and information from
there
i use the following to filter my answers for the report when pressing a
button on a form:

strReportName = "UpdateReport"
strCriteria = "[Assemblies_ComponentID] = '" & ComponentID.Value & "'"
DoCmd.OpenReport strReportName, acViewPreview

From there i have my report which gives me the different parentId there
are
several of them that i pull and i want to open another report for each of
them. Example:

I run the updateReport which has 15 parent id's in it and i extract those
into an array and throught hat i can use them to open other reports and
manipulate the data even more

So if i have:
Dim parentarray()

redim parentarray(Report_UpdateReport.Count )

For i = 1 To Report_UpdateReport.Count
parentarray(i - 1) = ?????
MsgBox parentarray(i - 1)
Next i

I need to get the ?? part figured out.

Serveral people suggest using .eof and such but my access just won't do it
for some reason. I am using 2003

~Daniel

Ken Snell said:
You've posted this question in many newsgroups. .... one is usually
sufficient.

You cannot get data from a report... but you can get data from a query
that
is the record source of a report.

Can you tell us many more details, please, about what you want to
accomplish.
 
T

TheGerman

Hello, i've tried the code you send me such that:

im dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("CostQuery", dbOpenDynaset) <-----
If rst.EOF = False And rst.BOF = False Then
rst.MoveFirst
Do While rst.EOF = False
myvalue = rst.Fields("Patientid").Value
MsgBox myvalue
rst.MoveNext
Loop
End If
rst.Close
Set rst = Nothing
dbs.Close
Set dbs = Nothing

and i am getting an error where the <--- it says:

Run-time error '3061'
Too frew parameters. Expected 1.

any ideas?


Ken Snell said:
The reason people have suggested that you would use the .EOF property is
that they are assuming that you are opening a recordset based on the same
query that the report is using, and that you're looping through that
recordset to read the values from each record.

I'm sorry, but I'm just not following what you want to do specifically.

Generically, you open a recordset and loop through it:

Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("QueryOrTableOrSQLStatement", dbOpenDynaset)
If rst.EOF = False And rst.BOF = False Then
rst.MoveFirst
Do While rst.EOF = False
MyValue = rst.Fields("FieldName").Value
rst.MoveNext
Loop
End If
rst.Close
Set rst = Nothing
dbs.Close
Set dbs = Nothing


--

Ken Snell
<MS ACCESS MVP>

TheGerman said:
I really need an answer and i am just having no luck anywhere with anyone!

I am using a Query which complies a lot of tables and information from
there
i use the following to filter my answers for the report when pressing a
button on a form:

strReportName = "UpdateReport"
strCriteria = "[Assemblies_ComponentID] = '" & ComponentID.Value & "'"
DoCmd.OpenReport strReportName, acViewPreview

From there i have my report which gives me the different parentId there
are
several of them that i pull and i want to open another report for each of
them. Example:

I run the updateReport which has 15 parent id's in it and i extract those
into an array and throught hat i can use them to open other reports and
manipulate the data even more

So if i have:
Dim parentarray()

redim parentarray(Report_UpdateReport.Count )

For i = 1 To Report_UpdateReport.Count
parentarray(i - 1) = ?????
MsgBox parentarray(i - 1)
Next i

I need to get the ?? part figured out.

Serveral people suggest using .eof and such but my access just won't do it
for some reason. I am using 2003

~Daniel

Ken Snell said:
You've posted this question in many newsgroups. .... one is usually
sufficient.

You cannot get data from a report... but you can get data from a query
that
is the record source of a report.

Can you tell us many more details, please, about what you want to
accomplish.

--

Ken Snell
<MS ACCESS MVP>


Hello,

I hope somone can help me solve this problem!

I need to fill an array with Data from a Report!


For i = 1 To Report_UpdateReport.Count

myarray(i) = ?

Next i

How do i fill the array with the information? People suggest me to use
the
.EOF command but access dosn't seem to find that command.
I would highly appriciate it if you could help me fill this array. The
field in my report i want is called "parentid" and the reports anme is
UpdateReport

Thank you very much!

~Daniel
 
D

Douglas J. Steele

Assuming that CostQuery is a query, does it have a parameter in it? (When
you run it interactively, do you have to supply a value?)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



TheGerman said:
Hello, i've tried the code you send me such that:

im dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("CostQuery", dbOpenDynaset) <-----
If rst.EOF = False And rst.BOF = False Then
rst.MoveFirst
Do While rst.EOF = False
myvalue = rst.Fields("Patientid").Value
MsgBox myvalue
rst.MoveNext
Loop
End If
rst.Close
Set rst = Nothing
dbs.Close
Set dbs = Nothing

and i am getting an error where the <--- it says:

Run-time error '3061'
Too frew parameters. Expected 1.

any ideas?


Ken Snell said:
The reason people have suggested that you would use the .EOF property is
that they are assuming that you are opening a recordset based on the same
query that the report is using, and that you're looping through that
recordset to read the values from each record.

I'm sorry, but I'm just not following what you want to do specifically.

Generically, you open a recordset and loop through it:

Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("QueryOrTableOrSQLStatement", dbOpenDynaset)
If rst.EOF = False And rst.BOF = False Then
rst.MoveFirst
Do While rst.EOF = False
MyValue = rst.Fields("FieldName").Value
rst.MoveNext
Loop
End If
rst.Close
Set rst = Nothing
dbs.Close
Set dbs = Nothing


--

Ken Snell
<MS ACCESS MVP>

TheGerman said:
I really need an answer and i am just having no luck anywhere with
anyone!

I am using a Query which complies a lot of tables and information from
there
i use the following to filter my answers for the report when pressing a
button on a form:

strReportName = "UpdateReport"
strCriteria = "[Assemblies_ComponentID] = '" & ComponentID.Value &
"'"
DoCmd.OpenReport strReportName, acViewPreview

From there i have my report which gives me the different parentId there
are
several of them that i pull and i want to open another report for each
of
them. Example:

I run the updateReport which has 15 parent id's in it and i extract
those
into an array and throught hat i can use them to open other reports and
manipulate the data even more

So if i have:
Dim parentarray()

redim parentarray(Report_UpdateReport.Count )

For i = 1 To Report_UpdateReport.Count
parentarray(i - 1) = ?????
MsgBox parentarray(i - 1)
Next i

I need to get the ?? part figured out.

Serveral people suggest using .eof and such but my access just won't do
it
for some reason. I am using 2003

~Daniel

:

You've posted this question in many newsgroups. .... one is usually
sufficient.

You cannot get data from a report... but you can get data from a query
that
is the record source of a report.

Can you tell us many more details, please, about what you want to
accomplish.

--

Ken Snell
<MS ACCESS MVP>


Hello,

I hope somone can help me solve this problem!

I need to fill an array with Data from a Report!


For i = 1 To Report_UpdateReport.Count

myarray(i) = ?

Next i

How do i fill the array with the information? People suggest me to
use
the
.EOF command but access dosn't seem to find that command.
I would highly appriciate it if you could help me fill this array.
The
field in my report i want is called "parentid" and the reports anme
is
UpdateReport

Thank you very much!

~Daniel
 
T

TheGerman

No, it pulls it from a Form that is i run the code from via a button. I
found on a microsoft site that i need to add some stuff so i did and i came
up with this:

Dim myvalue As String
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef


Set dbs = CurrentDb
Set qdf = dbs.QueryDefs("CostQuery")
qdf.Parameters(0) = [Forms]![Cost Update].[ComponentID].[Value]


Set rst = qdf.OpenRecordset

rst.MoveFirst
Do While rst.EOF = False
myvalue = rst.Fields("Parentid").Value
MsgBox myvalue
rst.MoveNext
Loop
rst.Close
qdf.Close
Set rst = Nothing
Set qdf = Nothing
dbs.Close
Set dbs = Nothing

So far this seems to work, it gives me the numbers i'm looking for!



Douglas J. Steele said:
Assuming that CostQuery is a query, does it have a parameter in it? (When
you run it interactively, do you have to supply a value?)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



TheGerman said:
Hello, i've tried the code you send me such that:

im dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("CostQuery", dbOpenDynaset) <-----
If rst.EOF = False And rst.BOF = False Then
rst.MoveFirst
Do While rst.EOF = False
myvalue = rst.Fields("Patientid").Value
MsgBox myvalue
rst.MoveNext
Loop
End If
rst.Close
Set rst = Nothing
dbs.Close
Set dbs = Nothing

and i am getting an error where the <--- it says:

Run-time error '3061'
Too frew parameters. Expected 1.

any ideas?


Ken Snell said:
The reason people have suggested that you would use the .EOF property is
that they are assuming that you are opening a recordset based on the same
query that the report is using, and that you're looping through that
recordset to read the values from each record.

I'm sorry, but I'm just not following what you want to do specifically.

Generically, you open a recordset and loop through it:

Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("QueryOrTableOrSQLStatement", dbOpenDynaset)
If rst.EOF = False And rst.BOF = False Then
rst.MoveFirst
Do While rst.EOF = False
MyValue = rst.Fields("FieldName").Value
rst.MoveNext
Loop
End If
rst.Close
Set rst = Nothing
dbs.Close
Set dbs = Nothing


--

Ken Snell
<MS ACCESS MVP>

I really need an answer and i am just having no luck anywhere with
anyone!

I am using a Query which complies a lot of tables and information from
there
i use the following to filter my answers for the report when pressing a
button on a form:

strReportName = "UpdateReport"
strCriteria = "[Assemblies_ComponentID] = '" & ComponentID.Value &
"'"
DoCmd.OpenReport strReportName, acViewPreview

From there i have my report which gives me the different parentId there
are
several of them that i pull and i want to open another report for each
of
them. Example:

I run the updateReport which has 15 parent id's in it and i extract
those
into an array and throught hat i can use them to open other reports and
manipulate the data even more

So if i have:
Dim parentarray()

redim parentarray(Report_UpdateReport.Count )

For i = 1 To Report_UpdateReport.Count
parentarray(i - 1) = ?????
MsgBox parentarray(i - 1)
Next i

I need to get the ?? part figured out.

Serveral people suggest using .eof and such but my access just won't do
it
for some reason. I am using 2003

~Daniel

:

You've posted this question in many newsgroups. .... one is usually
sufficient.

You cannot get data from a report... but you can get data from a query
that
is the record source of a report.

Can you tell us many more details, please, about what you want to
accomplish.

--

Ken Snell
<MS ACCESS MVP>


Hello,

I hope somone can help me solve this problem!

I need to fill an array with Data from a Report!


For i = 1 To Report_UpdateReport.Count

myarray(i) = ?

Next i

How do i fill the array with the information? People suggest me to
use
the
.EOF command but access dosn't seem to find that command.
I would highly appriciate it if you could help me fill this array.
The
field in my report i want is called "parentid" and the reports anme
is
UpdateReport

Thank you very much!

~Daniel
 
K

Ken Snell [MVP]

Getting a value from a form's control is also a parameter to the query....
it's just that the query gets the data from the form without asking you for
it. Try running it without the form open, and then you'll see the parameter
prompt.

So, yes, your query does contain a parameter.

--

Ken Snell
<MS ACCESS MVP>

TheGerman said:
No, it pulls it from a Form that is i run the code from via a button. I
found on a microsoft site that i need to add some stuff so i did and i
came
up with this:

Dim myvalue As String
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef


Set dbs = CurrentDb
Set qdf = dbs.QueryDefs("CostQuery")
qdf.Parameters(0) = [Forms]![Cost Update].[ComponentID].[Value]


Set rst = qdf.OpenRecordset

rst.MoveFirst
Do While rst.EOF = False
myvalue = rst.Fields("Parentid").Value
MsgBox myvalue
rst.MoveNext
Loop
rst.Close
qdf.Close
Set rst = Nothing
Set qdf = Nothing
dbs.Close
Set dbs = Nothing

So far this seems to work, it gives me the numbers i'm looking for!



Douglas J. Steele said:
Assuming that CostQuery is a query, does it have a parameter in it? (When
you run it interactively, do you have to supply a value?)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



TheGerman said:
Hello, i've tried the code you send me such that:

im dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("CostQuery", dbOpenDynaset) <-----
If rst.EOF = False And rst.BOF = False Then
rst.MoveFirst
Do While rst.EOF = False
myvalue = rst.Fields("Patientid").Value
MsgBox myvalue
rst.MoveNext
Loop
End If
rst.Close
Set rst = Nothing
dbs.Close
Set dbs = Nothing

and i am getting an error where the <--- it says:

Run-time error '3061'
Too frew parameters. Expected 1.

any ideas?


:

The reason people have suggested that you would use the .EOF property
is
that they are assuming that you are opening a recordset based on the
same
query that the report is using, and that you're looping through that
recordset to read the values from each record.

I'm sorry, but I'm just not following what you want to do
specifically.

Generically, you open a recordset and loop through it:

Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("QueryOrTableOrSQLStatement",
dbOpenDynaset)
If rst.EOF = False And rst.BOF = False Then
rst.MoveFirst
Do While rst.EOF = False
MyValue = rst.Fields("FieldName").Value
rst.MoveNext
Loop
End If
rst.Close
Set rst = Nothing
dbs.Close
Set dbs = Nothing


--

Ken Snell
<MS ACCESS MVP>

I really need an answer and i am just having no luck anywhere with
anyone!

I am using a Query which complies a lot of tables and information
from
there
i use the following to filter my answers for the report when
pressing a
button on a form:

strReportName = "UpdateReport"
strCriteria = "[Assemblies_ComponentID] = '" & ComponentID.Value &
"'"
DoCmd.OpenReport strReportName, acViewPreview

From there i have my report which gives me the different parentId
there
are
several of them that i pull and i want to open another report for
each
of
them. Example:

I run the updateReport which has 15 parent id's in it and i extract
those
into an array and throught hat i can use them to open other reports
and
manipulate the data even more

So if i have:
Dim parentarray()

redim parentarray(Report_UpdateReport.Count )

For i = 1 To Report_UpdateReport.Count
parentarray(i - 1) = ?????
MsgBox parentarray(i - 1)
Next i

I need to get the ?? part figured out.

Serveral people suggest using .eof and such but my access just won't
do
it
for some reason. I am using 2003

~Daniel

:

You've posted this question in many newsgroups. .... one is usually
sufficient.

You cannot get data from a report... but you can get data from a
query
that
is the record source of a report.

Can you tell us many more details, please, about what you want to
accomplish.

--

Ken Snell
<MS ACCESS MVP>


Hello,

I hope somone can help me solve this problem!

I need to fill an array with Data from a Report!


For i = 1 To Report_UpdateReport.Count

myarray(i) = ?

Next i

How do i fill the array with the information? People suggest me
to
use
the
.EOF command but access dosn't seem to find that command.
I would highly appriciate it if you could help me fill this
array.
The
field in my report i want is called "parentid" and the reports
anme
is
UpdateReport

Thank you very much!

~Daniel
 
T

TheGerman

I have another question.

I have a report in which i calculate a running sum. I want to be able to
copy that into a Table. The Report will only result in one line always. I
have a "Temp" Global Variable setup which saves it.

On a form i can just use Tcost.value = temp and it updates it, but it does
not work in the form. Since i save it in a global variable i can use it
anywhere.

What would be the best way to insert that into the table? I am thinking
maybe and SQL statment?

~Daniel


Ken Snell said:
Getting a value from a form's control is also a parameter to the query....
it's just that the query gets the data from the form without asking you for
it. Try running it without the form open, and then you'll see the parameter
prompt.

So, yes, your query does contain a parameter.

--

Ken Snell
<MS ACCESS MVP>

TheGerman said:
No, it pulls it from a Form that is i run the code from via a button. I
found on a microsoft site that i need to add some stuff so i did and i
came
up with this:

Dim myvalue As String
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef


Set dbs = CurrentDb
Set qdf = dbs.QueryDefs("CostQuery")
qdf.Parameters(0) = [Forms]![Cost Update].[ComponentID].[Value]


Set rst = qdf.OpenRecordset

rst.MoveFirst
Do While rst.EOF = False
myvalue = rst.Fields("Parentid").Value
MsgBox myvalue
rst.MoveNext
Loop
rst.Close
qdf.Close
Set rst = Nothing
Set qdf = Nothing
dbs.Close
Set dbs = Nothing

So far this seems to work, it gives me the numbers i'm looking for!



Douglas J. Steele said:
Assuming that CostQuery is a query, does it have a parameter in it? (When
you run it interactively, do you have to supply a value?)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Hello, i've tried the code you send me such that:

im dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("CostQuery", dbOpenDynaset) <-----
If rst.EOF = False And rst.BOF = False Then
rst.MoveFirst
Do While rst.EOF = False
myvalue = rst.Fields("Patientid").Value
MsgBox myvalue
rst.MoveNext
Loop
End If
rst.Close
Set rst = Nothing
dbs.Close
Set dbs = Nothing

and i am getting an error where the <--- it says:

Run-time error '3061'
Too frew parameters. Expected 1.

any ideas?


:

The reason people have suggested that you would use the .EOF property
is
that they are assuming that you are opening a recordset based on the
same
query that the report is using, and that you're looping through that
recordset to read the values from each record.

I'm sorry, but I'm just not following what you want to do
specifically.

Generically, you open a recordset and loop through it:

Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("QueryOrTableOrSQLStatement",
dbOpenDynaset)
If rst.EOF = False And rst.BOF = False Then
rst.MoveFirst
Do While rst.EOF = False
MyValue = rst.Fields("FieldName").Value
rst.MoveNext
Loop
End If
rst.Close
Set rst = Nothing
dbs.Close
Set dbs = Nothing


--

Ken Snell
<MS ACCESS MVP>

I really need an answer and i am just having no luck anywhere with
anyone!

I am using a Query which complies a lot of tables and information
from
there
i use the following to filter my answers for the report when
pressing a
button on a form:

strReportName = "UpdateReport"
strCriteria = "[Assemblies_ComponentID] = '" & ComponentID.Value &
"'"
DoCmd.OpenReport strReportName, acViewPreview

From there i have my report which gives me the different parentId
there
are
several of them that i pull and i want to open another report for
each
of
them. Example:

I run the updateReport which has 15 parent id's in it and i extract
those
into an array and throught hat i can use them to open other reports
and
manipulate the data even more

So if i have:
Dim parentarray()

redim parentarray(Report_UpdateReport.Count )

For i = 1 To Report_UpdateReport.Count
parentarray(i - 1) = ?????
MsgBox parentarray(i - 1)
Next i

I need to get the ?? part figured out.

Serveral people suggest using .eof and such but my access just won't
do
it
for some reason. I am using 2003

~Daniel

:

You've posted this question in many newsgroups. .... one is usually
sufficient.

You cannot get data from a report... but you can get data from a
query
that
is the record source of a report.

Can you tell us many more details, please, about what you want to
accomplish.

--

Ken Snell
<MS ACCESS MVP>


Hello,

I hope somone can help me solve this problem!

I need to fill an array with Data from a Report!


For i = 1 To Report_UpdateReport.Count

myarray(i) = ?

Next i

How do i fill the array with the information? People suggest me
to
use
the
.EOF command but access dosn't seem to find that command.
I would highly appriciate it if you could help me fill this
array.
The
field in my report i want is called "parentid" and the reports
anme
is
UpdateReport

Thank you very much!

~Daniel
 
T

TheGerman

sorry typo... it should say:

I have another question.

I have a report in which i calculate a running sum. I want to be able to
copy that into a Table. The Report will only result in one line always. I
have a "Temp" Global Variable setup which saves it.

On a form i can just use Tcost.value = temp and it updates it, but it does
not work in the REPORT<--. Since i save it in a global variable i can use it
anywhere.

What would be the best way to insert that into the table? I am thinking
maybe and SQL statment?



Ken Snell said:
Getting a value from a form's control is also a parameter to the query....
it's just that the query gets the data from the form without asking you for
it. Try running it without the form open, and then you'll see the parameter
prompt.

So, yes, your query does contain a parameter.

--

Ken Snell
<MS ACCESS MVP>

TheGerman said:
No, it pulls it from a Form that is i run the code from via a button. I
found on a microsoft site that i need to add some stuff so i did and i
came
up with this:

Dim myvalue As String
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef


Set dbs = CurrentDb
Set qdf = dbs.QueryDefs("CostQuery")
qdf.Parameters(0) = [Forms]![Cost Update].[ComponentID].[Value]


Set rst = qdf.OpenRecordset

rst.MoveFirst
Do While rst.EOF = False
myvalue = rst.Fields("Parentid").Value
MsgBox myvalue
rst.MoveNext
Loop
rst.Close
qdf.Close
Set rst = Nothing
Set qdf = Nothing
dbs.Close
Set dbs = Nothing

So far this seems to work, it gives me the numbers i'm looking for!



Douglas J. Steele said:
Assuming that CostQuery is a query, does it have a parameter in it? (When
you run it interactively, do you have to supply a value?)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Hello, i've tried the code you send me such that:

im dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("CostQuery", dbOpenDynaset) <-----
If rst.EOF = False And rst.BOF = False Then
rst.MoveFirst
Do While rst.EOF = False
myvalue = rst.Fields("Patientid").Value
MsgBox myvalue
rst.MoveNext
Loop
End If
rst.Close
Set rst = Nothing
dbs.Close
Set dbs = Nothing

and i am getting an error where the <--- it says:

Run-time error '3061'
Too frew parameters. Expected 1.

any ideas?


:

The reason people have suggested that you would use the .EOF property
is
that they are assuming that you are opening a recordset based on the
same
query that the report is using, and that you're looping through that
recordset to read the values from each record.

I'm sorry, but I'm just not following what you want to do
specifically.

Generically, you open a recordset and loop through it:

Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("QueryOrTableOrSQLStatement",
dbOpenDynaset)
If rst.EOF = False And rst.BOF = False Then
rst.MoveFirst
Do While rst.EOF = False
MyValue = rst.Fields("FieldName").Value
rst.MoveNext
Loop
End If
rst.Close
Set rst = Nothing
dbs.Close
Set dbs = Nothing


--

Ken Snell
<MS ACCESS MVP>

I really need an answer and i am just having no luck anywhere with
anyone!

I am using a Query which complies a lot of tables and information
from
there
i use the following to filter my answers for the report when
pressing a
button on a form:

strReportName = "UpdateReport"
strCriteria = "[Assemblies_ComponentID] = '" & ComponentID.Value &
"'"
DoCmd.OpenReport strReportName, acViewPreview

From there i have my report which gives me the different parentId
there
are
several of them that i pull and i want to open another report for
each
of
them. Example:

I run the updateReport which has 15 parent id's in it and i extract
those
into an array and throught hat i can use them to open other reports
and
manipulate the data even more

So if i have:
Dim parentarray()

redim parentarray(Report_UpdateReport.Count )

For i = 1 To Report_UpdateReport.Count
parentarray(i - 1) = ?????
MsgBox parentarray(i - 1)
Next i

I need to get the ?? part figured out.

Serveral people suggest using .eof and such but my access just won't
do
it
for some reason. I am using 2003

~Daniel

:

You've posted this question in many newsgroups. .... one is usually
sufficient.

You cannot get data from a report... but you can get data from a
query
that
is the record source of a report.

Can you tell us many more details, please, about what you want to
accomplish.

--

Ken Snell
<MS ACCESS MVP>


Hello,

I hope somone can help me solve this problem!

I need to fill an array with Data from a Report!


For i = 1 To Report_UpdateReport.Count

myarray(i) = ?

Next i

How do i fill the array with the information? People suggest me
to
use
the
.EOF command but access dosn't seem to find that command.
I would highly appriciate it if you could help me fill this
array.
The
field in my report i want is called "parentid" and the reports
anme
is
UpdateReport

Thank you very much!

~Daniel
 

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