Good afternoon,



First of all i would like to thank you in advance for your patience and for taking your time helping me.

I am working on a database for our employees in our laboratory.

I made a form with 4 subforms, which can be accessed by using tabs.

On the 2nd tab / subform i made a graph based on data on subform 1. I also added a refresh button so the user can refresh the graph if there has been any changes to the data. So far so good.

What i realised while working on the form, is that the auto scaling in Access when it comes to graph isnt always accurate, so i would like to be able to manually adjust the scale of the axes, by using a textbox / combobox as input. And when i click the button 'Modify' or something it updates the graph with the given scale.

Is this possible within Access? If yes, how should i start?

Ive made the same 'Function' in Excel a few years back.

Using the following code:

Code:
 
Private Sub Aanpassen_Click()
Sheets("Invoer").Cells(16, 25) = xmin
Sheets("Invoer").Cells(16, 26) = eenh
Sheets("Invoer").Cells(21, 25) = ymin
Sheets("Invoer").Cells(21, 26) = yeenh
Sheets("Grafiek").Select
    ActiveSheet.ChartObjects("Grafiek 31").Activate
 
With ActiveChart.Axes(xlCategory)
        .MinimumScale = Sheets("Invoer").Range("Y16")
        .MaximumScale = Sheets("Invoer").Range("Y17")
        .MajorUnit = 1
        .CrossesAt = Sheets("Invoer").Range("Y18")
    End With
    ActiveChart.Axes(xlValue).Select
    With ActiveChart.Axes(xlValue)
        .MinimumScale = Sheets("Invoer").Range("Y21")
        .MaximumScale = Sheets("Invoer").Range("Y22")
        .MajorUnit = 10
    End With
Sheets("Grafiek").Range("N13").Select
Aanpasas.Hide
End
But it doesnt quite work when i try to put this in Access VBA.

With a couple of changes ofcourse. This is what ive got so far:

Code:
 
Private Sub Knop179_Click()
 
Me.Grafiek156.Active
     Grafiek156 is the name of the graph
With ActiveChart.Axes(xlCategory)
        .MinimumScale = Me.cboxmin.Value
        .MaximumScale = Me.cboxeenh.Value
      The me.cboxmin.Value and me.cboeenh.Value are the 2 txt boxes on the form. (For the X-Axis)
        .MajorUnit = 1
        '.CrossesAt = Sheets("Invoer").Range("Y18")
    End With
    ActiveChart.Axes(xlValue).Select
    With ActiveChart.Axes(xlValue)
        .MinimumScale = Me.cboymin.Value
        .MaximumScale = Me.cboyeenh.Value
These are also text boxes on the form (for the Y-Axis)
        .MajorUnit = 10
    End With
'Sheets("Grafiek").Range("N13").Select
'Aanpasas.Hide
End Sub
Do you have any idea how i can get this to work? Been working on it non-stop and to be honest, im getting frustrated.

Cheers!