Form within Add-In (1 Viewer)

mrrcomp

Registered User.
Local time
Tomorrow, 01:41
Joined
May 3, 2010
Messages
16
Hi
I am writing an Add-In. The add-in successfully creates tables and data in the users application then next stage is a form within the Add-in should link the rowsource of listboxes to the table that were created in the users app. Nothing I've tried works . The listboxes are always without the data

suggestions??

Meir :confused::confused::confused:
 

Trevor G

Registered User.
Local time
Today, 23:41
Joined
Oct 1, 2009
Messages
2,341
Hi Meir,

Can you post your code that you are trying to use for the listbox and its source.
 

Trevor G

Registered User.
Local time
Today, 23:41
Joined
Oct 1, 2009
Messages
2,341
Here is an extract of code which will fill a listbox with object names

Private Sub Form_Load()
Dim accObject As Access.AccessObject

'Fill with Tables
For Each accObject In CurrentData.AllTables
Me.listObjects.AddItem "TABLE;" & accObject.Name
Next

'If currently opened file is an Access database (mdb), then fill
'with queries.
'Otherwise, if it is an Access project (adp), fill with views,
'stored procedures, database diagrams, and functions.
If CurrentProject.ProjectType = acMDB Then
For Each accObject In CurrentData.AllQueries
Me.listObjects.AddItem "QUERY;" & accObject.Name
Next
Else
For Each accObject In CurrentData.AllViews
Me.listObjects.AddItem "VIEW;" & accObject.Name
Next
For Each accObject In CurrentData.AllStoredProcedures
Me.listObjects.AddItem "PROCEDURE;" & accObject.Name
Next
For Each accObject In CurrentData.AllDatabaseDiagrams
Me.listObjects.AddItem "DIAGRAM;" & accObject.Name
Next
For Each accObject In CurrentData.AllFunctions
Me.listObjects.AddItem "FUNCTION;" & accObject.Name
Next
End If

'Fill list with forms.
For Each accObject In CurrentProject.AllForms
Me.listObjects.AddItem "FORM;" & accObject.Name
Next
'Fill list with reports.
For Each accObject In CurrentProject.AllReports
Me.listObjects.AddItem "REPORT;" & accObject.Name
Next
'Fill list with data access pages.
For Each accObject In CurrentProject.AllDataAccessPages
Me.listObjects.AddItem "PAGE;" & accObject.Name
Next
'Fill list with macros.
For Each accObject In CurrentProject.AllMacros
Me.listObjects.AddItem "MACRO;" & accObject.Name
Next
'Fill list with modules.
For Each accObject In CurrentProject.AllModules
Me.listObjects.AddItem "MODULE;" & accObject.Name
Next
End Sub
 

mrrcomp

Registered User.
Local time
Tomorrow, 01:41
Joined
May 3, 2010
Messages
16
Hi Trevor
Thanks for the response. I was actually looking for a method to get the data from a table in the currentproject into the listbox. I found a work around where as I create the tables etc that I need in the Add-IN and only at the end of all my processes do I copy the tables down into the users app.

Thanks for your response.
Regards
Meir R
 

mrrcomp

Registered User.
Local time
Tomorrow, 01:41
Joined
May 3, 2010
Messages
16
Trevor Hi

Was wondering if i could pick your brain for one more point with regards to Access Add-In.

I have a function in the Add-In for example

Public Function getlan() as string

getlan="bla bla bla"
end function

When I attempt to call the function from within a form in the current users project I get sub or function not defined error..

What am i missing??

Thanks for your time..

Regards
Meir
 

Trevor G

Registered User.
Local time
Today, 23:41
Joined
Oct 1, 2009
Messages
2,341
Hi Meir,

I think that as you have this as a public function as discribed

Public Function getlan() as string


you would need to change it to

Function getlan()


Then you can call it from a form or control etc.

Regards
 

mrrcomp

Registered User.
Local time
Tomorrow, 01:41
Joined
May 3, 2010
Messages
16
HI

Had it originally as just function. didn't work thought that making it public would open it up..

Regards

Meir
 

Users who are viewing this thread

Top Bottom