Filter Subform Records

  • Thread starter CWH via AccessMonster.com
  • Start date
C

CWH via AccessMonster.com

I was wondering if someone can look over the code below. My main form has a
control command (buttom) for a subform. I am trying to have the control
dispaly the message below if three fields are left blank (TeamName, Incident#,
Incident_Date). If data is entered then I would like the subform (Coordinate
Index - Incident) to open and filter just those records that have the same
incident# as the main form.

Any help would be appreicated.

..............................................................................
...........

Private Sub Command99_Click()


If Me.TeamName = False Then
If Me.Incident_ = False Then
If Me.Incident_Date = False Then

MsgBox "Enter Required Fields (Team Name, Incident#, Date) and try again.
", 48, "Data Warning..."
Exit Sub

Else

Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Forms!Coordinate Index - Incident"

stLinkCriteria = "[Incident #]=" & "'" & Me![Incident#] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria


End If
End If
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top