Dear Friends,
I have Module called ConnectDatabase and in this module we written all database related functions. We have couple of databases and all these database details we have defined in below table.
Format of the table (tbl_Supp_Databases) is below
DatabaseCodeDatabaseNameDatabasePathDatabasePasswordConnectDB_StringBADB TOOL.mdbY:\MIS Database ConnectDatabase.ConnectBaDatabase()BAUUtilities DB.mdbY:\MIS Database²¢xṲBAU Utilities DB.mdbÛГConnectDatabase.ConnectBauDatabase()TOSSUtilities TOSS DB.mdbC:\\MyDoc\MS Access\ALL DB³Ï…UTOSS Utilities DB.mdb̤ÛГConnectDatabase.ConnectTossDatabase()… so on… so on… so on… so on… so on
ConnectDB_String contains ModuleName [ConnectDatabase] + Function Name [ConnectBaDatabase()]. I'm trying to write generic code to check if database is available and password is correct. Below is the code:
I have written below code to extract ConnectDB_String value and
strSelectSQL = "SELECT ConnectDB_String FROM tbl_Supp_Databases where ConnectDB_String <> """" "
Set rsTmp = gsSecuredDatabase.OpenRecordset(strSelectSQL)
If Not rsTmp.EOF And rsTmp.BOF = False Then
Do While Not rsTmp.EOF
'Check the connectivity for MS Access Database
If rsTmp!ConnectDB_String() = False Then
iOk = MsgBox("Unable to open BAC Database", vbCritical, "BAC Database not found")
End If
rsTmp.MoveNext
Loop
End If
rsTmp!ConnectDB_String() is returning the value ConnectDatabase.ConnectBaDatabase() but this function is not called I think coz it's treated as a string. How to convert this string to call ConnectBaDatabase() function which is under ConnectDatabase Module.
Thanks
Ria
I have Module called ConnectDatabase and in this module we written all database related functions. We have couple of databases and all these database details we have defined in below table.
Format of the table (tbl_Supp_Databases) is below
DatabaseCodeDatabaseNameDatabasePathDatabasePasswordConnectDB_StringBADB TOOL.mdbY:\MIS Database ConnectDatabase.ConnectBaDatabase()BAUUtilities DB.mdbY:\MIS Database²¢xṲBAU Utilities DB.mdbÛГConnectDatabase.ConnectBauDatabase()TOSSUtilities TOSS DB.mdbC:\\MyDoc\MS Access\ALL DB³Ï…UTOSS Utilities DB.mdb̤ÛГConnectDatabase.ConnectTossDatabase()… so on… so on… so on… so on… so on
ConnectDB_String contains ModuleName [ConnectDatabase] + Function Name [ConnectBaDatabase()]. I'm trying to write generic code to check if database is available and password is correct. Below is the code:
I have written below code to extract ConnectDB_String value and
strSelectSQL = "SELECT ConnectDB_String FROM tbl_Supp_Databases where ConnectDB_String <> """" "
Set rsTmp = gsSecuredDatabase.OpenRecordset(strSelectSQL)
If Not rsTmp.EOF And rsTmp.BOF = False Then
Do While Not rsTmp.EOF
'Check the connectivity for MS Access Database
If rsTmp!ConnectDB_String() = False Then
iOk = MsgBox("Unable to open BAC Database", vbCritical, "BAC Database not found")
End If
rsTmp.MoveNext
Loop
End If
rsTmp!ConnectDB_String() is returning the value ConnectDatabase.ConnectBaDatabase() but this function is not called I think coz it's treated as a string. How to convert this string to call ConnectBaDatabase() function which is under ConnectDatabase Module.
Thanks
Ria