Access displaying records

PrettyMess

Board Regular
Joined
Feb 10, 2015
Messages
66
Hi,

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.

Any help would be greatly appreciated.

I think it may need to look something like this:

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

Thanks
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
If the form is based on a query, a calculated field Res:[OutboundReservations]<>0 And [InboundReservations]<>0 with criteria <>0 will prevent the record - no code needed, other than whatever you're already using to refresh/requery the form. Generally speaking, forms are more flexible if they're based on queries as opposed to tables.
If you must do it in code, your first problem is that this "OutboundReservations.Value And InboundReservations.Value" makes no sense to Access - it is not read/interpreted the way you are doing so. It has to be more like OutboundReservations.Value = 0 And InboundReservations.Value = 0
To not show the record would require a requery of the form (or application/re-application of a filter). This is a bit harder to do if based on a table. Now you have to create/modify and apply a filter. If you create a named filter (filter query), you might as well base the form on a query.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top