How to prevent MS Access database from opening when reading data from forms

To count Activex controls from MS-Access forms using vb.net I am using a connection as described below.

oDBEngine = oAccess.DBEngine oDB = oDBEngine.OpenDatabase (Name: = strFullFileName, Options: = False, ReadOnly: = False, Connect: = "")

and opening forms in design mode , since there is a user input request form that prevents us from starting the application further if we open it in the default view.

oAccess.DoCmd.OpenForm (FormName: = objForms.Name, View: = AcFormView.acDesign)

Now the problem is this:

The database is opened and at the same time all forms are opened during application launch. In any case, we simply prohibit opening the database and forms while reading the forms.

Thank.

0


source to share


2 answers


Sounds like a non-split application (tables and forms / etc in one MDB file) and that it is being used by multiple users. This is a disastrous scenario. See Splitting your Microsoft Access MDB front and back for all the details.



Once you split it, you work with a separate copy and then distribute updates to users. The fact is that since version 2000 the Access MDB design (unlike data) cannot be edited while it is open by all users.

+2


source


You may need to use a new, blank database and import the forms programmatically. It may be possible to get a list of forms from MSysObjects (form type is -32768).

For example:

SELECT MsysObjects.Name
FROM MsysObjects IN 'C:\docs\LTD.mdb'
WHERE MsysObjects.Type=-32768

      



EDIT COMMENT This code will reside in the BLANK Access database.

strSQL = "SELECT MsysObjects.Name " _
& "FROM MsysObjects IN 'C:\docs\LTD.mdb' " _
& "WHERE MsysObjects.Type = -32768"

Set rs = CurrentDb.OpenRecordset(strSQL)

Do While Not rs.EOF
    DoCmd.TransferDatabase acImport, "Microsoft Access", _
    "C:\docs\LTD.mdb", acForm, rs![Name], rs![Name]

    'Do what ever you wish with form, then '

    DoCmd.DeleteObject acForm, rs![Name]

    rs.MoveNext
Loop

      

+1


source







All Articles