dbTalk Databases Forums  

Validating read-only form on an empty database

comp.database.ms-access comp.database.ms-access


Discuss Validating read-only form on an empty database in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Richard
 
Posts: n/a

Default Validating read-only form on an empty database - 04-27-2004 , 11:49 AM






I am almost at the end of creating one of my first partially
successful database, however i have found an error upon it. I have
created a button on the switchboard which will open up one of my
form's in a read-only format, this is so the user can search through
the clients' currently in the database without the risk of deleting /
editing them.

The problem is that if the database is empty it comes up with a debug
error reading, "you can't go to the specified record". I would like to
be able to write some validation code that will bring up a message box
informing the user that the database is empty, and then close the
form.

If anybody can help me then i would be very greatful

Cheers,

Rich

Reply With Quote
  #2  
Old   
Ray
 
Posts: n/a

Default Re: Validating read-only form on an empty database - 04-30-2004 , 08:22 AM






Cassyman (AT) hotmail (DOT) com (Richard) wrote in message news:<8bf3cbf6.0404270849.d3861d0 (AT) posting (DOT) google.com>...
Quote:
I am almost at the end of creating one of my first partially
successful database, however i have found an error upon it. I have
created a button on the switchboard which will open up one of my
form's in a read-only format, this is so the user can search through
the clients' currently in the database without the risk of deleting /
editing them.

The problem is that if the database is empty it comes up with a debug
error reading, "you can't go to the specified record". I would like to
be able to write some validation code that will bring up a message box
informing the user that the database is empty, and then close the
form.

If anybody can help me then i would be very greatful

Cheers,

Rich
Hello Rich,

Perhaps what you need to do is put a bit of code
behind the button on your switchboard.

Example:

'This checks the record source for your form and
see's if there is any data, if so, the form will
open, if not, a message will display.

Dim intValue as Integer
intValue = DCount("[FieldName]","QueryName")

If intValue = 0 then
MsgBox "Sorry, no data to view!", vbCritical, "No Data"
Else
DoCmd.OpenForm "frmName"
End if

Regards,

Ray


Reply With Quote
  #3  
Old   
Richard
 
Posts: n/a

Default Re: Validating read-only form on an empty database - 05-02-2004 , 05:50 AM



raycait (AT) excite (DOT) com (Ray) wrote in message news:<20ba9f4a.0404300522.5995148 (AT) posting (DOT) google.com>...
Quote:
Cassyman (AT) hotmail (DOT) com (Richard) wrote in message news:<8bf3cbf6.0404270849.d3861d0 (AT) posting (DOT) google.com>...
I am almost at the end of creating one of my first partially
successful database, however i have found an error upon it. I have
created a button on the switchboard which will open up one of my
form's in a read-only format, this is so the user can search through
the clients' currently in the database without the risk of deleting /
editing them.

The problem is that if the database is empty it comes up with a debug
error reading, "you can't go to the specified record". I would like to
be able to write some validation code that will bring up a message box
informing the user that the database is empty, and then close the
form.

If anybody can help me then i would be very greatful

Cheers,

Rich

Hello Rich,

Perhaps what you need to do is put a bit of code
behind the button on your switchboard.

Example:

'This checks the record source for your form and
see's if there is any data, if so, the form will
open, if not, a message will display.

Dim intValue as Integer
intValue = DCount("[FieldName]","QueryName")

If intValue = 0 then
MsgBox "Sorry, no data to view!", vbCritical, "No Data"
Else
DoCmd.OpenForm "frmName"
End if

Regards,

Ray

Hey Ray,

Cheers buddy that works a treat! One step closer to finishing it now! :-P

Thanx again mate.

Rich


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.