Re: No Record Found
- From: "Mike from Moriches" <Mike@xxxxxxxxxxxxxxxxx>
- Date: Mon, 25 Aug 2008 07:37:53 -0400
Thank you all for the help. I went with Chris's DCount approach which works perfectly.
"Chris O'C via AccessMonster.com" <u29189@uwe> wrote in message news:892b609459d1e@xxxxxx
You could use DCount to find out how many records match before opening the
other form. If it's less than 1, that record doesn't exist, so don't open
the form, but tell the user there's no matching record with a message box.
if dcount("field", "table", "wherecondition") < 1 then
msgbox "There's no record matching that criteria"
else
docmd.openform "formname",acNormal,,"wherecondition"
end if
Chris
Microsoft MVP
Mike from Moriches wrote:I have a simple form for updating records. I do a DoCmd.Openform with a
WHERE clause that works great when there is a record that matches the WHERE
clause. The form opens populated with data from the record. My problem is
when the User keys in wrong information and no record is returned. The form
opens with no data. Is there something similiar to the "No Data" event in a
report that I can use to display an error message rather than the blank
form?
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200808/1
.
- References:
- No Record Found
- From: Mike from Moriches
- Re: No Record Found
- From: Chris O'C via AccessMonster.com
- No Record Found
- Prev by Date: Re: Changing the background color and re-linking the backend when
- Next by Date: RE: finding a record based on a combo box choice
- Previous by thread: Re: No Record Found
- Next by thread: Re: No Record Found
- Index(es):
Relevant Pages
|