Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi, I created a control to open a

Status
Not open for further replies.

sjmojeck

Technical User
Sep 6, 2001
24
US
Hi,
I created a control to open a search form based on a search using the following criteria:
To open the form I use the event
DoCmd.OpenForm "Search User", acViewNormal, acEdit

The form itself has the sql query:
SELECT [Contacts Temp].PIDMs, [Contacts Temp].PIDM, [Contacts Temp].GWBMAIL_ID, [Contacts Temp].LAST_NAME, [Contacts Temp].FIRST_NAME, [Contacts Temp].MI, [Contacts Temp].COMPANY, [Contacts Temp].ATYP_CODE, [Contacts Temp].STREET_LINE1, [Contacts Temp].STREET_LINE2, [Contacts Temp].STREET_LINE3, [Contacts Temp].CITY, [Contacts Temp].STAT_CODE, [Contacts Temp].ZIP, [Contacts Temp].NATN_CODE, [Contacts Temp].EMAIL, [Contacts Temp].USER, [Contacts Temp].CREATE_DATE, [Contacts Temp].GWBMAIL_SOURCE
FROM [Contacts Temp]
WHERE ((([Contacts Temp].LAST_NAME) Like [Enter Last Name - Full, Partial or Blank] & "*") AND (([Contacts Temp].FIRST_NAME) Like [Enter First Name - Full, Partial or Blank] & "*"))
ORDER BY [Contacts Temp].LAST_NAME;

I need a way to have a msgbox display, close the form, and reopen the original form if the form opens without records.
Thanks
 
Private Sub Form_Open(Cancel As Integer)
dim rst as recordset

set rst=me.recordsetclone
'or >>> set rst=currentdb.openrecordset(me.recordsource)
if rst.eof then
msgbox "Blah ......"
cancel=true
end if
rst.close
set rst=nothing
End Sub

Aivars
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top