Charting question

G

Guest

I have set up a database in my hospital that records patient records. I have
a main form to display the patients details and then a series of subforms
embedded in that main form to display data from different aspects of the
patients care. One of these forms displays time related data in datasheet
format. Each subform is linked to the master via the patients unique hospital
identifier number. What I'd like to do is display the datasheet data in a
chart as data point against time point. I have managed to produce the chart
OK and embed it as a subform on the master, but it displays all the data in
the underlying table rather that just the data for that particular patient.
How can I get the chart to display just patient specific data (based on the
hospital identifier) as my other subforms do?

Thanks for your help,
Ian.
 
G

Guest

I have'nt tried it with charts, but i have had such problems with some
special sub forms. I wrote in the subform a function like this :

Public sub SetPatID (value as long)

me.recordsource = "SELECT * FROM [subtable] where PatID = " & cstr(value)
me.requery

end

In the main form in the Current - Event you have to call

me.subformname.form.setPatID(me!patID)

In this way you are able to pass more than one parameter to the subform.

Tino
 
G

Guest

Tino,

Thanks for your reply and sorry for the delay in responding.

Forgive my ignorance but when you say:
"...I wrote in the subform a function like this :..."

where exactly in the subform did you add this function. I tried putting it
in a Module, but .Recordsource wasn't recognised and then I put it in a Class
module but this wouldn't work either.

Thanks for your thoughts,
Ian.

tino said:
I have'nt tried it with charts, but i have had such problems with some
special sub forms. I wrote in the subform a function like this :

Public sub SetPatID (value as long)

me.recordsource = "SELECT * FROM [subtable] where PatID = " & cstr(value)
me.requery

end

In the main form in the Current - Event you have to call

me.subformname.form.setPatID(me!patID)

In this way you are able to pass more than one parameter to the subform.

Tino




Ian said:
I have set up a database in my hospital that records patient records. I have
a main form to display the patients details and then a series of subforms
embedded in that main form to display data from different aspects of the
patients care. One of these forms displays time related data in datasheet
format. Each subform is linked to the master via the patients unique hospital
identifier number. What I'd like to do is display the datasheet data in a
chart as data point against time point. I have managed to produce the chart
OK and embed it as a subform on the master, but it displays all the data in
the underlying table rather that just the data for that particular patient.
How can I get the chart to display just patient specific data (based on the
hospital identifier) as my other subforms do?

Thanks for your help,
Ian.
 
G

Guest

Hi Ian,

first let me say sorry: I use the german versions of Access and so i only
know the german names of the menuitems and toolbuttons. I try a translation,
but it would be that the 'real' names are different. If there are problems,
please ask me again.

To write the code do the following
1. Open the subform within the designer
2. Click in the mainmenu <view> --> <code> You get a window for typing your
VBA - Code
3. Type the Sub (SetPatID) in this window.
4. Try, if your typing was correct : <Debug> --> <compile> If there are no
errors, safe the form.
5. Open the main form in the designer, maximize the designer. Normally your
form would be smaller then the whole window, now click in the area out of the
form (dark gray with no hor/vert lines)
6. choose <view> --> <properties>
7. choose in the property editor the tab <events>
8. choose <current> (first entry) --> <...> --> <code> --> Access opens the
VBA - Window and generates the lines :
Form_Current ()

End Sub

9. Type between these lines so that it looks like here :
Form_Current ()
me.subformname.form.setPatID(me!patID)
End sub
10. save the mainform an try.

11. hope you succeded !



Ian said:
Tino,

Thanks for your reply and sorry for the delay in responding.

Forgive my ignorance but when you say:
"...I wrote in the subform a function like this :..."

where exactly in the subform did you add this function. I tried putting it
in a Module, but .Recordsource wasn't recognised and then I put it in a Class
module but this wouldn't work either.

Thanks for your thoughts,
Ian.

tino said:
I have'nt tried it with charts, but i have had such problems with some
special sub forms. I wrote in the subform a function like this :

Public sub SetPatID (value as long)

me.recordsource = "SELECT * FROM [subtable] where PatID = " & cstr(value)
me.requery

end

In the main form in the Current - Event you have to call

me.subformname.form.setPatID(me!patID)

In this way you are able to pass more than one parameter to the subform.

Tino




Ian said:
I have set up a database in my hospital that records patient records. I have
a main form to display the patients details and then a series of subforms
embedded in that main form to display data from different aspects of the
patients care. One of these forms displays time related data in datasheet
format. Each subform is linked to the master via the patients unique hospital
identifier number. What I'd like to do is display the datasheet data in a
chart as data point against time point. I have managed to produce the chart
OK and embed it as a subform on the master, but it displays all the data in
the underlying table rather that just the data for that particular patient.
How can I get the chart to display just patient specific data (based on the
hospital identifier) as my other subforms do?

Thanks for your help,
Ian.
 
G

Guest

Hi Tino,

That seems to working OK, I just need to tidy things up but everything works
without error

Cheers,
Ian.

tino said:
Hi Ian,

first let me say sorry: I use the german versions of Access and so i only
know the german names of the menuitems and toolbuttons. I try a translation,
but it would be that the 'real' names are different. If there are problems,
please ask me again.

To write the code do the following
1. Open the subform within the designer
2. Click in the mainmenu <view> --> <code> You get a window for typing your
VBA - Code
3. Type the Sub (SetPatID) in this window.
4. Try, if your typing was correct : <Debug> --> <compile> If there are no
errors, safe the form.
5. Open the main form in the designer, maximize the designer. Normally your
form would be smaller then the whole window, now click in the area out of the
form (dark gray with no hor/vert lines)
6. choose <view> --> <properties>
7. choose in the property editor the tab <events>
8. choose <current> (first entry) --> <...> --> <code> --> Access opens the
VBA - Window and generates the lines :
Form_Current ()

End Sub

9. Type between these lines so that it looks like here :
Form_Current ()
me.subformname.form.setPatID(me!patID)
End sub
10. save the mainform an try.

11. hope you succeded !



Ian said:
Tino,

Thanks for your reply and sorry for the delay in responding.

Forgive my ignorance but when you say:
"...I wrote in the subform a function like this :..."

where exactly in the subform did you add this function. I tried putting it
in a Module, but .Recordsource wasn't recognised and then I put it in a Class
module but this wouldn't work either.

Thanks for your thoughts,
Ian.

tino said:
I have'nt tried it with charts, but i have had such problems with some
special sub forms. I wrote in the subform a function like this :

Public sub SetPatID (value as long)

me.recordsource = "SELECT * FROM [subtable] where PatID = " & cstr(value)
me.requery

end

In the main form in the Current - Event you have to call

me.subformname.form.setPatID(me!patID)

In this way you are able to pass more than one parameter to the subform.

Tino




:

I have set up a database in my hospital that records patient records. I have
a main form to display the patients details and then a series of subforms
embedded in that main form to display data from different aspects of the
patients care. One of these forms displays time related data in datasheet
format. Each subform is linked to the master via the patients unique hospital
identifier number. What I'd like to do is display the datasheet data in a
chart as data point against time point. I have managed to produce the chart
OK and embed it as a subform on the master, but it displays all the data in
the underlying table rather that just the data for that particular patient.
How can I get the chart to display just patient specific data (based on the
hospital identifier) as my other subforms do?

Thanks for your help,
Ian.
 

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