help with scatter plot (1 Viewer)

hassane

New member
Local time
Today, 06:12
Joined
Feb 2, 2016
Messages
5
Hello everyone,

I am new to this forum, but it was a great help for me.However this time I was not able to solve my problem without asking :)

I have a scatter plot on one form( already done)..the values will never change.

However when the user enter some data on a separate form I want to open the form where the plot exists to compare the user data to my scatter plot.
Here is a summary:
1- user enter data<=== done
2-click a button to open a new form where the plot exists<===done
3- add the data by the user to the existing chart for compare( usually a single point to be compared to the plot)<=== not done

How I can complete step three? I know it's easy using Excel..but I need it in Access.
thank you.
 

sneuberg

AWF VIP
Local time
Today, 06:12
Joined
Oct 17, 2014
Messages
3,506
I don't know much about charts, but since no one seems to be helping you, I'll see what I can do. Please be patient with me I just learning about this.

I found that a scatter chart is normally based on the data in a table or query. The first column is associated with the X axis and the second with the first series of the Y axis. An additional series would be adding by adding a third column to the row source of the chart. So to have a place to store this single point I believe you will need to add another field to the table that holds that chart data and then add it to the row source of the chart.

Then in the open form event you can add update statements to add the data point to the table before the chart is opened. I guessing you want the data point deleted when the chart form is closed. If the first form is left open you can get the information needed to delete the data point from it. If you close the first form you will have to pass the information to the chart form via open args or tempvars.

If you upload your database I could give you more specific help.

Added: Check the added posts that follow this.
 
Last edited:

sneuberg

AWF VIP
Local time
Today, 06:12
Joined
Oct 17, 2014
Messages
3,506
I just thought of another possible way that wouldn't involve having to update or delete records from tables. You might be able to create a query which has expression equal to the form values of the extra point. The query would have expressions like:

XPoint: [Forms]![TheNameoftheFirstForm]![TheNameoftheTextboxwithX]
YPoint:
ZPoint: [Forms]![TheNameoftheFirstForm]![TheNameoftheTextboxwithY]

Then add a place holder expression to the existing row source of the chart for the third column and then use the union of the two as the new row source of the chart.

I'll test this theory and let you know by tomorrow if it works.
 

sneuberg

AWF VIP
Local time
Today, 06:12
Joined
Oct 17, 2014
Messages
3,506
The idea in my previous post didn't work. Access complains about having to have at least one table or query when you try to make union with a query of just expressions.

Nonetheless I was able to fix that by adding a table to hold the point to be added to the chart. With the point store in a table the union query works. You can see this work in the attached database. In this database you will find:

  1. ChartData - A table which hold some X Y data for the chart
  2. NewPointTable - A table which hold the X and Y values of the point to be added to the chart.
  3. NewPointsForm - A form where you can add the new point and then open the ChartForm to display the chart.
  4. ChartForm - Contains the scatter chart
  5. ChartRowSource - A query of the ChartData table with a place holder column for the point to be added. This is incorporated into the ChartRowSourceUnion, i.e., is not used
  6. Expression Query - A query of the NewPointTable with a place holder column for the existing Y data from the ChartDate table. This also is incorporated into the ChartRowSourceUnion, i.e., is not used
  7. CharRowSourceUnion - A union query which is a union of the ChartRowSource and the Expression Query and is the row source of the chart.
So this is one way to do it. If your new point is already bound to some table then this will even be easier.
 

Attachments

  • ScatterChart.zip
    28.8 KB · Views: 114

hassane

New member
Local time
Today, 06:12
Joined
Feb 2, 2016
Messages
5
Thanks a lot!! it works
you guys are awesome..
sorry for the double post btw.
 

Users who are viewing this thread

Top Bottom