Den VBA-Code (VisualBasic-for-Applications-Code) kann man durch die Erzeugung einer MDE-Datei schuetzen, da dann so etwas wie ein Bytecode erstellt wird, fuer den ich bisher keinen Decompiler finden konnte. (Menue: Tools->Database Utilities->Make MDE-File). Aber Achtung die orginale MDB-Datei sollte immer gesichert werden!
Der integrierte Passwortschutz fuer eigene Projekte ist uebrigens unsicher und leicht zu umgehen.
Entries tagged with “access”.
Thu 27 Jul 2006
MS Access: Code verstecken / schuetzen
Posted by Ralf under VBA
No Comments
Sat 8 Apr 2006
MS Access: Multiselect in Queries
Posted by Ralf under IT, VBA
[28] Comments
In MS Access verwendet man in den Benutzerschnittstellen gern Listen mit Multiselect-Funktion, um dem Anwender flexiblere Auswahlmöglichkeiten zu bieten.
In Queries ist es jedoch etwas schwierig diese Optionen abzufragen. Folgende VBA-Funktion schafft da Abhilfe:
Function InMultiSelect(frms, ctrl As String, col As Integer, data As Variant, ParamArray OtherArgs()) As Boolean
'Checks whether a Variant (data or OtherArgs) is included in the specified column (col) of a ListBox (ctrl)
'in a certain Form (frms)
On Error GoTo Error_InMultiSelect
Dim varItm As Variant
Dim index As Integer
Dim ctl As Control
Dim frm As Form
Set frm = Forms(frms)
Set ctl = frm.Controls(ctrl)
InMultiSelect = False
For Each varItm In ctl.ItemsSelected
If InMultiSelect = True Then Exit For
If CStr(data) = CStr(ctl.Column(col, varItm)) Then InMultiSelect = True
For index = LBound(OtherArgs) To UBound(OtherArgs)
If InMultiSelect = True Then Exit For
If CStr(OtherArgs(index)) = CStr(ctl.Column(col, varItm)) Then InMultiSelect = True
Next index
Next varItm
Exit Function
Error_InMultiSelect:
InMultiSelect = False
Exit Function
End Function
In den Abfragen (Queries) selbst wird diese Funktion dann beispielsweise so aufgerufen:
SELECT *
FROM [tblTabelle]
WHERE InMultiSelect("[frmFormMitMultiSelectAuswahl]","[lstListeMitMultiSelectAuswahl]",0,[tblTabelle].[Spalte]))<>False);
Sat 8 Apr 2006
MS Access: IF EXISTS DROP TABLE
Posted by Ralf under IT, VBA
[17] Comments
Leider ist es in MS Access nicht ohne weiteres möglich das Vorhandensein einer Tabelle abzufragen.
Dies wird gerade wenn man mit temporären Tabellen arbeitet zum Problem.
Eine Abhilfe liefert folgende VBA-Funktion:
' check if a table exists
Function tableExists(tableName As String) As Boolean
On Error GoTo Error_tableExists
Dim strTableName
' assign tableName to String
strTableName = CurrentDb.TableDefs(tableName)
' if no error occurs then set tableExists to true
tableExists = True
Exit_tableExists:
On Error Resume Next
Exit Function
Error_tableExists:
Select Case Err.Number
Case 3265 'Item not found in this collection
tableExists = False
Resume Exit_tableExists
Case Else
MsgBox "Error " & Err.Number & ": " & Err.Description, vbCritical
Resume Exit_tableExists
End Select
End Function