Home>
Issues/things I want to solve

I am creating a purchase order using Access.
I want to reflect the calculation result from the check box on the form in the table.

Status

I'm currently creating a purchase order using Access.
There are check boxes for "Quotation 1" and "Quotation 2" on the form.
If i check either one, you can display the checked quotation in "Purchase" of the form. (Completed on the form)

To the place of purchase
The function "= IIf ([Quotation 1 check] = True, [Quotation 1], IIf ([Quotation 2 check] = True, [Quotation 2], null)" is used.
I want to reflect this calculation result in the table, but I can't find it even if I check it.

The basic idea is not to store calculation results in Access. Please tell me.

  • Answer # 1

    Since the specifications are not clear,

    The record source of the form has fields "Purchase", "Quote 1", and "Quote 2".

    Checkboxes are arranged independently and are unconnected.

    Only one check can be entered.

    Assuming that, the VBA code will be as follows.

    Private Sub Quotation 1 Check _Click ()
        If Me. Estimate 1 check And Me. Estimate 2 check Then
            Me. Quoted 2 Check = False
        End If
        Call update Where to buy
    End Sub
    Private Sub Quotation 2 Check _Click ()
        If Me. Estimate 1 check And Me. Estimate 2 check Then
            Me. Quoted 1 Check = False
        End If
        Call update Where to buy
    End Sub
    Public Sub update Where to buy ()
        If Me. Estimate 1 Check Then
            Me. Where to buy. Value = Me. Where to quote 1. Value
        ElseIf Me. Estimate 2 Check Then
            Me. Where to buy. Value = Me. Where to quote 2. Value
        Else
            Me. Where to buy. Value = Null
        End If
    End Sub

    If the specifications differ from the above assumptions, please add a clear specification to the question text.