vbams-access

VBA referencing external module in .accdb database "tantrum"


When referencing a module in another .accdb database everything went Ok until I select the file and hit OK button

In VBA editor,
Tools->References <select .accdb file> and hit OK button

then access spits the error ->

"name conflicts with existing module, project or object library"

after lots of AI/google/perplexity etc. nothing solved the issue... I decided to edge test the "oddity"...

to replicate:

create 2 new blank databases like 'a.accdb' and 'b.accdb'
create a module in b.accdb and a simple "hello-world" procedure
save and close...

now open the other b.accdb file open VBA editor (Alt+F11)
go to Tools->References
select 'a.accdb' file and hit OK button

You should now be getting the
"name conflicts with existing module, project or object library"
error!!!

?Any ideas of what is going on...


Solution

  • When you create a database, Access assigns a default project name. This name is the same in every database, hence the name conflict error. In the VBA Editor in either database, go into Tools -> Database Properties and change the Project Name to something else. You can now set a reference to the other database without experiencing that error.