Access and browsing add in

georj

Board Regular
Joined
Oct 13, 2003
Messages
74
I have a pice of code in access which refreshes the tables but how do i get a browse button in the code i have to give the option to find it.

Cheers Jason

Public Function RefreshAttachments()

Dim sTemporaryDatabase As String, sMainDatabase As String, sArchiveDatabase As String
Dim iTableCount As Integer, iAttachCount As Integer

sMainDatabase = GetSetting(ProgramName, "Files", "MainDatabase", "")
sMainDatabase = InputBox$("Enter the location of the system's main database", , sMainDatabase)
If sMainDatabase > "" Then
SaveSetting ProgramName, "Files", "MainDatabase", sMainDatabase

iTableCount = 28

iAttachCount = Abs(AttachTable(sMainDatabase, "Changeover Time"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Circulation Group"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Circulation List"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Concept Notification"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Customer"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Development - Commercial and Development"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Development - Factory Trial Record"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Development - Gate"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Development - Micro Shelflife"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Development - Organoleptic Shelflife"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Development - Planning Issues"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Development - Process Technologist Issues"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Development - Purchasing Issues"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Development - Technical Issues"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Development Header"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Development Recipe"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Group Report"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Pack Type"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Person Customer"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Person Group"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Person Site"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Personnel"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Preservation Method"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Processing Step"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Product Master"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Reports"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Site"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Supplier"))

If iTableCount = iAttachCount Then
MsgBox "Main database tables now attached to " & sMainDatabase, vbInformation
Else
MsgBox "The was an error attaching the main database tables to " & sMainDatabase, vbInformation
End If
End If

sTemporaryDatabase = GetSetting(ProgramName, "Files", "TemporaryDatabase", "")
sTemporaryDatabase = InputBox$("Enter the location of the system's temporary database", , sTemporaryDatabase)
If sTemporaryDatabase > "" Then
SaveSetting ProgramName, "Files", "TemporaryDatabase", sTemporaryDatabase
iTableCount = 1

iAttachCount = Abs(AttachTable(sTemporaryDatabase, "Temp: Print List"))

If iTableCount = iAttachCount Then
MsgBox "Temporary database tables now attached to " & sTemporaryDatabase, vbInformation
Else
MsgBox "The was an error attaching the temporary database tables to " & sTemporaryDatabase, vbInformation
End If
End If

sArchiveDatabase = GetSetting(ProgramName, "Files", "ArchiveDatabase", "")
sArchiveDatabase = InputBox$("Enter the location of the system's archive database", , sArchiveDatabase)
If sArchiveDatabase > "" Then
SaveSetting ProgramName, "Files", "ArchiveDatabase", sArchiveDatabase

iTableCount = 12

iAttachCount = Abs(AttachTable(sArchiveDatabase, "Concept Notification", "Concept Notification (archive)"))
iAttachCount = iAttachCount + Abs(AttachTable(sArchiveDatabase, "Development - Commercial and Development", "Development - Commercial and Development (archive)"))
iAttachCount = iAttachCount + Abs(AttachTable(sArchiveDatabase, "Development - Factory Trial Record", "Development - Factory Trial Record (archive)"))
iAttachCount = iAttachCount + Abs(AttachTable(sMainDatabase, "Development - Gate", "Development - Gate (archive)"))
iAttachCount = iAttachCount + Abs(AttachTable(sArchiveDatabase, "Development - Micro Shelflife", "Development - Micro Shelflife (archive)"))
iAttachCount = iAttachCount + Abs(AttachTable(sArchiveDatabase, "Development - Organoleptic Shelflife", "Development - Organoleptic Shelflife (archive)"))
iAttachCount = iAttachCount + Abs(AttachTable(sArchiveDatabase, "Development - Planning Issues", "Development - Planning Issues (archive)"))
iAttachCount = iAttachCount + Abs(AttachTable(sArchiveDatabase, "Development - Process Technologist Issues", "Development - Process Technologist Issues (archive)"))
iAttachCount = iAttachCount + Abs(AttachTable(sArchiveDatabase, "Development - Purchasing Issues", "Development - Purchasing Issues (archive)"))
iAttachCount = iAttachCount + Abs(AttachTable(sArchiveDatabase, "Development - Technical Issues", "Development - Technical Issues (archive)"))
iAttachCount = iAttachCount + Abs(AttachTable(sArchiveDatabase, "Development Header", "Development Header (archive)"))
iAttachCount = iAttachCount + Abs(AttachTable(sArchiveDatabase, "Development Recipe", "Development Recipe (archive)"))

If iTableCount = iAttachCount Then
MsgBox "Archive database tables now attached to " & sArchiveDatabase, vbInformation
Else
MsgBox "The was an error attaching the archive database tables to " & sArchiveDatabase, vbInformation
End If
End If

End Function
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
In the code a form has been created using code it has an OK and cancel button but no browse button i was wondering could any point me in the right direction to add one...

help Jason
 
Upvote 0
I don't see where you have created a form.

You have used a message box.

If you wish to add a browse button to that I think you may find it difficult.

It is possible I believe but involves using the API.

You can create your own forms via code but that is also quite complicated.
 
Upvote 0
you are right it is a message box. I di not right this i have picked it up and trying to make it a little more user friendly. what would i have to do to use API's never used them before is it possible to do what i have asked?

Jason
 
Upvote 0
Have a look here if you really want to go that way.

Customize MessageBox

Why not create an unbound form with buttons that carry out what you want.
 
Upvote 0
Would it take a lot to adjust the code to create unbound form?
looking at that link you sent me is a bit above me i need alot more practing and reading.

thank you Jason
 
Upvote 0
Why not just create one using Access?

i.e. just Insert>Form
 
Upvote 0

Forum statistics

Threads
1,221,776
Messages
6,161,870
Members
451,727
Latest member
tyedye4

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top