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!

How do you make the table Casiuss is on about?

Status
Not open for further replies.

Odeysseus

Programmer
Apr 23, 2001
4
IE
how do you go about creating that table casiuss is making to set a number of times your database will open, i see you create the table in the mde file but what next?
 
Guessing you're referring to some posting elsewhere on this forum. Please tell us what it is! If you want information regarding a particular posting, please continue the existing thread .
 
Step 1.
Just create the table called something like, "OpenCount". Then, create a field that is an "Autonumber" type.

Step 2.
When the MDE starts up, it should launch either a form or an "autoexec" macro. If Autoexec, then have it launch your start-up code and add a conditional statement that makes a function call the following code (It may need some debugging!)..

' If this function returns TRUE, then limit reached.
Private Function OpenCount() as Boolean

DIm rcCount as Recordset

OpenCount = False
Set rcCount = Currentdb.OpenRecordset("OpenCount")
If Not rcCOunt.BOF then rcCOunt.MoveLast

If rcCount.RecordCount > 5 then
' notify user of open limit reached.
OpenCount = True
Else
rcCOunt.AddNew
rcCount.Update
rcCount.Close
End if

Set rcCOunt = nothing

End Function

I thought this up in a hurry. The reason why I am using an auto-number is (for some bizarre reason! I don't know! It just popped into my head!) to give some security that the table is not manipulated numerically. :)

Gary
gwinn7
 
Ahhhh yes, there is a bug in it. Be sure to enclose the "If rcCount.RecordCount > 5..." as part of the false condition of the "If NOT rcCount.BOF then...". Otherwise, the code will probably error when it hits the rcCount.RecordCount clause.

Gary
gwinn7

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top