0

I can get the following code to run manually on a button but it will not do anything when put into the on load event of the form. I'm sure I'm missing something obvious but can't see what it is! "newenquirysiteslistq" is a query of address's based on the name of the customer within the form.

Private Sub Form_Load()
If Nz(dcount("*", "newenquirysiteslistq"), 0) < 2 Then
    Me.previous_sites.Visible = False
    Else
    Me.previous_sites.Visible = True
    End If
End Sub
Ming
  • 1
  • But as the form hasn't loaded yet, the query can't retrieve the customer's name or ID. So, rethink this. – Gustav Mar 28 '22 at 17:22
  • 1
    Of course! new it was simple. I have moved the code to got focus of the first control on the form and its working fine. Thanks. – Ming Mar 28 '22 at 17:41

0 Answers0