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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying a Mssg when no records in a Table 1

Status
Not open for further replies.

Gazer44

Technical User
Mar 4, 2002
211
US
I have 2 forms :- form1 to SUBMIT records onto a table & form2 to VIEW/EDIT these records.

When clicking form2 to VIEW records, if no records submitted yet I want to display a mssg saying "Please input a record".

After submiting a record, clicking form2 will then open OK and display the record.

I have tried different ways but having probs. Any Ideas ??
 
First of all you will need to write some VBA code on the ON OPEN event for Form2

Dim Db as Database, rst as Recordset, strMsg as String

Set Db = CurrentDB
Set rst = DB.OpenRecordSet("[TableName Where Records Exist]",dbOpenSnapShot)

IF rst.Recordcount = 0 then
msgbox "No Records Found to View" & vbcrlf & "Please Add a New Record Before Continuing"
Docmd.Close
EXIT SUB
END IF


Try That

Scott
 
Thanks very much Scottsanpedro, that works great,
much appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top