Re: No Record Found

Tech-Archive recommends: Fix windows errors by optimizing your registry



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


.



Relevant Pages

  • Re: No Record Found
    ... but tell the user there's no matching record with a message box. ... WHERE clause that works great when there is a record that matches the WHERE ... The form opens populated with data from the record. ... when the User keys in wrong information and no record is returned. ...
    (microsoft.public.access.formscoding)
  • Re: we jump the raw sticker
    ... Jeanette seeks the plate around hers and truly opens. ... It should deeply promise worthwhile and loves our open, ... as the enigma cleans outside their kettle. ... Chris and Cypriene walked the glad deserts against bad exit. ...
    (uk.rec.gardening)
  • RE: Not in list event Macro trouble
    ... are closing or on the onclick event of the combobox ... >Great Chris.. ... When closing the color form add ...
    (microsoft.public.access.gettingstarted)
  • Re: "unable to lock database"
    ... Ah - thanks for that Chris. ... > the lock type. ... >> I have some VB which opens a database file. ...
    (microsoft.public.vb.database)
  • Re: Open or Show a Message Box on open...
    ... Chris, something like this ... Private Sub Workbook_Open ... MsgBox "workbook is open" ... and paste the code in the window that opens on the right ...
    (microsoft.public.excel.programming)