Code to Delete Module

coolcatkelso

Registered User.
Local time
Today, 15:39
Joined
Jan 5, 2009
Messages
279
Hiya guys

I have a table in my database called tblDateFlagged which will flag 14 dates, after that the Dbase stops working.. This works perfect

I have added a button to the spalsh screen to (Unlock) the database

THe basis of this button is

Code:
 If UCase(strInput) = "8MEH-REDSL-7ETEC-ULA8R-EAOKL-4EMBR-ACED" Then
        DoCmd.RunSQL "DROP TABLE tblDateFlagged"
         Else
        MsgBox "Sorry wrong password."
   End If
End Sub

Which works no problems, it deletes the table as it should

But there is also a Module file working with this, called basFirstRun

Is there a way I can also delete that file?

Also when the button is clicked, and I enter the serial number, I get the error saying its already open, easy to resolve just click END and click the button again and enter the serial.. It deletes this time.. Is there a way around this?
________
Montana medical marijuana dispensaries
 
Last edited:
Sorry m8 didn't even realise you had responded

ok I see what you mean but don't know how to do that

My current setup is flag the date, the Module I have (basRunFirst) stops the Database on any system date change so you couldn't manually change the computer date.

I managed to get the code working and it now deletes the Flagged Table and corresponding Module, but as you say, this would be easy to get around in the first place and in order for the button to work just now, you have to enter details blah blah get the error that the table is locked, end it, do it all again and the button is still visable afterwords..

If we went with your Idea, "limit the number of times the Dbase can open" how easy would it be to disable this with the click of a button?
________
Nexium settlement news
 
Last edited:
If we went with your Idea, "limit the number of times the Dbase can open" how easy would it be to disable this with the click of a button?

check the number of times it has been opened, and then if you press the button, delete the module that contains ONLY the "check" code.
 
ok m8 sounds good

You got an example of this working?

I need to somehow turn the Dbase into a demo but still have a disable button to make it fully functional

Can you help?
________
HTTP://WWW.VAPORIZER.ORG/
 
Last edited:
ok m8 sounds good

You got an example of this working?

I need to somehow turn the Dbase into a demo but still have a disable button to make it fully functional

Can you help?
yes i can help. the best thing to do would be to upload a sample database here for me to download, and then I can show you how it works. the only reason I say this is because I do not have the time to make a sample database that works fairly well and show you directly. I am wondering though, why you can't do this yourself. it really is pretty easy to do. were the instructions i gave not clear?
 
why delete the module

just make the dbs an mde - nobody will be able to view your module or run procedures within it
 
Hiya guys

Thanks for the ideas and help

I managed to get something going myself tho

I have managed it roughly like this

I currently had Autoexec for my Demo

I created a new one (Without the Startup() Function) called it TempAutoexec

On the button I created - Unlock Demo
I added an Onclick control -

Onclick - Enter Serial - Correct serial then = Docmd.Delete Autoexec
DoCmd.Rename TempAutoexec to Autoexec

This allowed me to turn off the FlaggedDate and stop the modue from running.. and in turn has stopped the demo and made it full version

Seems to work well :D

Any comments?
________
FIX PS3
 
Last edited:
Hi,

if you delete the autoexec, whats to stop the database being mass distributed from after this point? if the autoexec didnt exist anymore, the db could be used freely!

i would always have the autoexec running and place a condition to validate the serial.

if demo = true then
run code condition 1
else
run code condition 2
end if

i would never remove the very item that would check for serial & demos, whats the point in that?



NS
 
Last edited:
Hiya m8

Cheers for the comments

You've brought up a good point that has also slipped my mind

I haven't deleted the whole Autoexec.. I have renamed it to DemoAutoexec and replaced this with a (Full Version) autoexec

But I see what you mean tho, I need something in the FullAutoexec to prevent illegal copies

Can you give more tips / advice on your idea?

I was wondering, know that you've mention it, but is there a way to add something in, that would pick up the Computer Name, and save this somewhere within the DB, and if the Dbase looks up the Computer Name and it doesn't match, then Close Dbase

Something like

Find Computer Name
IF Computer Name is correct
Then Run Dbase
If Not
Close Dbase?

I think this would prevent an illegal copy, unless you change your computer name
________
MAGIC FLIGHT LAUNCH BOX REVIEW
 
Last edited:
Hi

take a look at db properties. You can create a property and save the computer name there. Obviously, if it is a demo the computer name wouldn't be saved so everytime the db is opened, the validation is false thus demo. When the db is made into a full version, the name is saved in the db property and full version opens. This way if the db is moved, the computer names wouldn't match and a demo re appears.

You could also do this with a date to set a time limit. If validation is false, check dates.

The properties stay within the db and are not saved in an editable table.

Regs

ns
 
Cheers Nigel

I'll have a look now,, Any chance you can give step by step guide? lol I'm not that gr8 coding n such like.. How would I ask it to lookup Computer name?
________
AdorableBrina
 
Last edited:
ok, I've had a look. I had a sample Dbase on my PC that had something similair

Here is the Module

Code:
Option Compare Database
Private Declare Function apiGetComputerName Lib "kernel32" Alias _
"GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
 Public Function fOSMachineName() As String
'Returns the computername
Dim lngLen As Long, lngX As Long
Dim strCompName As String
lngLen = 16
strCompName = String$(lngLen, 0)
lngX = apiGetComputerName(strCompName, lngLen)
If lngX <> 0 Then
fOSMachineName = Left$(strCompName, lngLen)
Else
fOSMachineName = ""
End If
End Function

And its linked to a table which stores the PC Name - tblCName

So any ideas on the code I should be running to bring this all together?

I've attached the sample Dbase I had where I got the code from.. This is something I would like to see in My Dbase but I got errors when I copied it over

Works on the same idea as you tho

30 Days free trial, Enter Serial Code and it becomes full Dbase, and uses Computer Name as security for illegal copies

Its in Access 2002
________
OXYGEN VAPORIZER
 

Attachments

Last edited:
The extra security feature this has, is it creates a Temp Folder in the C Drive with a Txt file.. If that folder or File is deleted or Not copied to another pc then the Dbase will popup a message saying its pirated..

So rather than having that folder saved to C:\temp, I could hide it in the WIndows\system32 - If you didn't know that the Dbase creates this file, you would never know it was there. So if you tried to give the Dbase to someone else, they would need the same Reg Key you used, they would need to change their PC name to yours setup windows User with your name AND lol find the folder with the secret TXT Document

Its alot of security to tamper with? lol
________
Cheap crosman stinger shotgun cartridge shells
 
Last edited:
Hi,

ive done something similar before. i had a db placed in the windows/system32 folder and used the name function to rename it as a dll. when the db opened, it looked for the file. if it existed, it renamed it to mdb, opened it and collected a property.

NS
 
Hiya m8

Ok, I've added everything into my DB now and its almost working perfectly, but I get 1 error

Error 13 Type Mismatch "tblLicense"

Set MySet = MyDb.OpenRecordset("tblLicense")

Heres the whole code

Code:
Private Sub Form_Close()
Dim MyDb As Database
Dim MySet As Recordset
Set MyDb = DBEngine.Workspaces(0).Databases(0)
Set MySet = MyDb.OpenRecordset("tblLicense")
MySet.AddNew
MySet![txtKey1] = Me!txtKey1
MySet![txtKey2] = Me!txtKey2
MySet![txtKey3] = Me!txtKey3
MySet![txtKey4] = Me!txtKey4
MySet![txtKey5] = Me!txtKey5
'.....as many fields as you want to save......
MySet.Update
MySet.Close
MyDb.Close
End Sub

This code takes the serial number and adds it into the Table to store it

It does work if I delete this part but then it lacks 1 of the security options tho and I would prefer it to be there
________
Lightbulb Vaporizer Review
 
Last edited:
Change this:

Dim MyDb As Database
Dim MySet As Recordset

to this

Dim MyDb As DAO.Database
Dim MySet As DAO.Recordset
 
Bob m8, I could kiss ya lol

You've been a true star to me.. Its taken me 12 months to develope this Dbase and you've helped for 90% of it lol

Could'nt have done this without your help and everybody else's, your a true legend m8

I've been stuck on this Mismatch error on a few forms in my Dbase, and I'm sure you've always got the answer 100% but its never stuck in my mind.. So, whats the reason for changing it to
Dim MyDb As DAO.Database
Dim MySet As DAO.Recordset

lol?
________
Vapir No2
 
Last edited:
Because ADO and DAO each have a recordset object and it is best to distinguish because otherwise Access tries to determine what you are using and usually gets it wrong. It usually is based on which one is listed first in the references, but it is better to be explicit so that it doesn't need to attempt a guess.
 
Once again, pipped to the post by BL :)

I was going to suggest the same along with changing

MyDb.OpenRecordSet("tblLicence")

to

MyDb.OpenRecordset("tblLicence", DbOpenDynaSet)


(hopefully I've done that right, nothing in front of me except Father Ted special!)


Nidge
 

Users who are viewing this thread

Back
Top Bottom