SUBFORM CONTROLS (3 Viewers)

euphonium01

Registered User.
Local time
Today, 05:27
Joined
Nov 17, 2018
Messages
15
I have a database I did that lists Electrical connections, Modules, Fuses etc for an old Jaguar. I have a Form, ConnectorsF, that lists all the connectors on the vehicle and a Subform, ConnectorPinsSF, that lists how many pins/wires are in that Connector. Sometimes, there's only 1 pin/wire, others can be up to 50 or so.

The Subform has navigation buttons I created to advance through each pin/wire. What I need is for the navigation buttons to disappear if there's less than 1 pin/wire, and reappear when there's more than 1. The Subform has a counter control, PINCOUNT.

How do I get the Navigation Buttons on the Subform to disappear/appear. I am very new to VBA, so please help it be simple... I have an Event Procedure attached to the Subform's OnCurrent Event -
If Me.PINCOUNT > 1 Then
Me.First Record.Visible = True
Else: Me.FirstRecord.Visible=False
End If

The NextRecord, PreviousRecord etc were done the same, but none of it works.

I realise this is probably very simple, but its not to me... can anyone help please?
Paul
 
Are you able to post a sample db with test data? Are we talking about the built-in navigation buttons or something you created? To see how many records are in the subform, you can check its RecordCount property.

Sent from phone...
 
I’m a bit afraid to ask but could you share the relationship of the connections database?
 
you may try this on the subform's Current Event:
Code:
Private Sub Form_Current()
Dim bolVisible As Boolean
With Me
    bolVisible = (.Recordset.RecordCount > 1)
    !FirstRecord.Visible = bolVisible
    !NextRecord.Visible = bolVisible
    !PrevousRecord.Visible = bolVisible
    !LastRecord.Visible = bolVisible
End With
End Sub
 

Users who are viewing this thread

  • Back
    Top Bottom