Using add-in with internal databases.

A simple Test-Add-In:
The add-in creates the table usys_AddInDataTable in the calling application and enables the table data to be changed via the add-in form.
 

Attachments

Un simple complément de test :
Le complément crée la table usys_AddInDataTable dans l'application appelante et permet de modifier les données de la table via le formulaire de complément.

A simple Test-Add-In:
The add-in creates the table usys_AddInDataTable in the calling application and enables the table data to be changed via the add-in form.

Hi @Josef P.

Thank you for your testing program.
For your information, we can replace the subroutine in the subform with:
Code:
Public Sub SetData(ByVal SourceDb As String)

Me.RecordSource = "SELECT * FROM " & AddInTableName & "IN '" & SourceDb & "'"

End Sub

Another question :
What should I do with queries that were created in the add-in from the Querry tools Tab?
These tables are now in the calling program without a link to the add-in.

Do we have to recreate them by code in VBA with the connection to the calling program or is there a way in Design mode to define the connection?
 
A stored named query is a database object.
Code:
Dim qd As DAO.QueryDef
Debug.Print CodeDb.Name
For Each qd in CodeDb.QueryDefs
   Debug.Print qd.Name
   Debug.Print qd.SQL
Next
Debug.Print CurrentDb.Name
For Each qd in CurrentDb.QueryDefs
   Debug.Print qd.Name
   Debug.Print qd.SQL
Next

' for action queries
CurrentDb.Execute "QueryX", dbFailOnError
Code.Execute "QueryY", dbFailOnError
 
For your information, we can replace the subroutine in the subform with: ...
Yes, that is also possible. Just like select ..from [Connectionstring].Table ...
However, I don't see any advantage compared to the recordset variant.

What should I do with queries that were created in the add-in from the Querry tools Tab?
I would avoid any stored add-in database object that provides data to the application.
Can't you just use the SQL statement from it with the appropriate DAO.Database reference (CurrentDB)?
 

Users who are viewing this thread

Back
Top Bottom