Hi
I have a form which is used to update records on table 1. At the bottom of the form is a button to got to form 2 and display related records that exist. This works fine unless there are no related records on table 2. If this happens form 2 is just blank. What I would prefer is for a warning message to appear advising there are no records to amend.
I tried the following code:
Dim stDocName As String
Dim stLinkCriteria As String
Dim stLink As Integer, Count as Integer
stDocName = "Delete Document"
stLinkCriteria = "[Link]=" & "'" & Me![Combo97] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
stLink = Count([Link])
If stLink < 0 then
msgbox "No records exist."
End if
but just get errors. Can someone please point me in the right direction.
I have a form which is used to update records on table 1. At the bottom of the form is a button to got to form 2 and display related records that exist. This works fine unless there are no related records on table 2. If this happens form 2 is just blank. What I would prefer is for a warning message to appear advising there are no records to amend.
I tried the following code:
Dim stDocName As String
Dim stLinkCriteria As String
Dim stLink As Integer, Count as Integer
stDocName = "Delete Document"
stLinkCriteria = "[Link]=" & "'" & Me![Combo97] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
stLink = Count([Link])
If stLink < 0 then
msgbox "No records exist."
End if
but just get errors. Can someone please point me in the right direction.