HelpNewtoAccess
Member
- Local time
- Yesterday, 20:19
- Joined
- Dec 13, 2019
- Messages
- 79
Hi Micron,
Hopefully this will be enough to give you an overview of what is going on.
 Hopefully this will be enough to give you an overview of what is going on.
DoCmd.OpenForm "frmEquipInfo", acNormal, "", "[PointID]=" & ME.[id], , acDialogWhat only works for the 'first' record, the button visibility thing? That makes no sense unless maybe the field is not Null but contains an empty string. If that is the case I think the Nz expression will not do what you want. You can either check if there are zls in your data by querying this table field with "" as criteria (if you get any results, then they are empty strings). You could either remove them or alter the expression. The question would then be, how did they get there? Probably from imported data.I added the existing fields for Notes and PointID to the form and it only works for one record and one note... The first record in the query..
Public Function HasNote(NoteID As Long) As Boolean
  HasNote = DCount("*", "tblNotes", "NoteID = " & NoteID & " AND trim(Notes & ' ') <> '' ") > 0
End FunctionPublic Function OpenDetails()
  DoCmd.OpenForm "frmSearchAfc", , , "PointID = " & CLng(Me.ActiveControl.Tag), , acDialog
  ShowHideButtons
End FunctionPrivate Sub ShowHideButtons()
  Dim ctrl As Access.Control
  For Each ctrl In Me.Controls
    If ctrl.ControlType = acCommandButton And Right(ctrl.Name, 1) = "n" And ctrl.Tag <> "" Then
      ctrl.Visible = HasNote(ctrl.Tag)
    End If
  Next ctrl
End Sub