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.
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.