Paula
Paula

Reputation: 229

Access - Fields

I have two fields in my table if both of these fields values are "0" I don't want the record to show in my form but if it happens to be any other combination I do want it to show.

I'm figuring it needs to be some sort of If statement but I'm not sure how to get this to reflect in my form.

Im assuming it will need to look something like:

    Private Sub TypeList_AfterUpdate()
    If (OutboundReservations.Value And InboundReservations.Value = "0") Then Me.showrecord = False
    Else
    Me.showrecord = True
    End Sub
    End If

Any help would be greatly appreciated.

Thanks

Upvotes: 0

Views: 47

Answers (1)

Darren Bartrup-Cook
Darren Bartrup-Cook

Reputation: 19737

You could create a query based on your table that removes those records and use the query as the data source for your form.
Something like: SELECT Field1, Field2, Field3 FROM MyTable WHERE Field2 <> 0 AND Field3 <> 0

Or, as an alternative you could add the condition to the Filter property on the form: Field2 <> 0 AND Field3 <> 0 and set the Filter On Load property to Yes

Upvotes: 2

Related Questions