Barry, if you are creating a file for each student, you could include a
custom property that contains the student name.
Use the function below like this:
Call SetPropertyDAO(dbEngine(0)(0), "CreatedFor", dbText, "Fred Smith")
Later, when checking the student's work, you can then read the property in
the Immediate Window like this:
? dbEngine(0)(0).Properties("CreatedFor")
Function SetPropertyDAO(obj As Object, strPropertyName As String, intType As
Integer, varValue As Variant, Optional strErrMsg As String) As Boolean
On Error GoTo ErrHandler
'Purpose: Set a property for an object, creating if necessary.
'Arguments: obj = the object whose property should be set.
' strPropertyName = the name of the property to set.
' intType = the type of property (needed for creating)
' varValue = the value to set this property to.
' strErrMsg = string to append any error message to.
If HasProperty(obj, strPropertyName) Then
obj.Properties(strPropertyName) = varValue
Else
obj.Properties.Append obj.CreateProperty(strPropertyName, intType,
varValue)
End If
SetPropertyDAO = True
ExitHandler:
Exit Function
ErrHandler:
strErrMsg = strErrMsg & obj.Name & "." & strPropertyName & " not set to
" & varValue & ". Error " & Err.Number & " - " & Err.Description & vbCrLf
Resume ExitHandler
End Function
Public Function HasProperty(obj As Object, strPropName As String) As Boolean
'Purpose: Return true if the object has the property.
Dim varDummy As Variant
On Error Resume Next
varDummy = obj.Properties(strPropName)
HasProperty = (Err.Number = 0)
End Function
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
<ex********@gmail.comwrote in message
news:11**********************@t46g2000cwa.googlegr oups.com...
>I teach a class in MS Access 2003 to college students. I've had some
issues with students turning in .mdb files that were created by other
students and then only slightly modified to give some convincing
argument that they didn't cheat. I know about the "Properties" (which
is how I detected the "shared" database in the first place).
What I'd like to know is if there is a way I may personally assign an
identification alphanumeric to each mdb file that I send to a student
so that, when the file is returned to me via eMail or on disc or flash
media, I may check the file and know that Student A didn't turn in a
copy of Student B's file.
I'd prefer not to use the Properties dialog as it is only a matter of
time before someone catches on and alters the data there. I'd like to
find some place in the file (or add some sort of "secret pocket") into
which I may place the personally identifiable data. If I could paste
something in or add a resource only I could view (protected by either a
password or a means that only I would know) that would do it.
I would imagine that password-protecting this file for only the
specific piece of information I would be including would be impossible
as the students will need to have designer access in order to do their
homework.
Suggestions are welcomed. Thanks in advance.
Barry