My job has recently decided that I need to build a database of test pictures, I've read many forums on the link pictures / putting browse button as I gather it makes the database too large with attachments.
My problem is I think I grasp the concept but I cant seem to use the code / Im not sure where im actually putting the code.
Where do I put this ? does this go in the field or in a macro ?
Also for the browse to button I have this
Private Sub Explore_Click()
' Gets a filename from the filedialog control and puts it into
the
' "Filename" textbox control.
' Be sure to rename the Common Dialog Control "cd1"
[Code] ....
When i try to put this into a button it doesnt work.
I've attached my amazing database for reference, you will see pictures attached, these were before I knew about linking and I want the links to work like the attachments.
I am using Access 2003 in a simple database and want to add digital pictures of each item in my database.
Before trying to enhance the database with pictures; the various fields are filled with either descriptive text or numbers. The size of the mdb database file is 464k.
I recently wanted to add a picture of each database entry. After adding a picture that is only 300k in size the mdb file increase to 18MD. Then after adding another picture also of 300k bytes my database grew to 25MB.
In the drop down menus Under Tools - Database Utilities - I ran the Compact & Repair Database. This did not reduce the size.
In the database Form I am using a Bound Object Frame to hold the picture and yes I am not linking the picture I am including it in the database. But, would only expect it to increase the database size by slightly more than the picture size.
I should also point out that the only way I have found to get the picture to be visible (not just an icon of the type of picture file) is to right click on the Bound Object Frame scroll down and choose Insert Object. Click on Create New and select Adobe Photoshop Image. This open adobe photoshop I make sure the picture properties are creating a picture of 300k.
So my question(s) is again. Why is my database increasing in size so rapidly? Is there a better to insert picture into a database?
I have a form displaying records. I would like the user to be able to select a button, browse for a file on a shared drive and link it to that record.
I have been exploring hyperlinking, which works for the most part, although I need it to display the share name rather than the drive assignment for that user. Such as drive1folder rather than C:folder.
Hyperlinking also unfortunatly requires the user to right click on a field select edit hyperlink then browse.
Hello all: I'm trying to create a browse button in MS Access. Here is the code I've used so far:
Private Sub ImgBrowse_Click()
Dim OFN As OPENFILENAME On Error GoTo Err_cmdInsertPic_Click
' Set options for dialog box. With OFN .lpstrTitle = "Images" If Not IsNull([ImageFullPath]) Then .lpstrFile = [ImageFullPath] .flags = &H1804 ' OFN_FileMustExist + OFN_PathMustExist + OFN_HideReadOnly .lpstrFilter = MakeFilterString("Image files (*.bmp;*.gif;*.jpg;*.wmf)", "*.bmp;*.gif;*.jpg;*.wmf", _ "All files (*.*)", "*.*") End With
If OpenDialog(OFN) Then [ImageFullPath] = OFN.lpstrFile [ImagePicture].Picture = [ImageFullPath] SysCmd acSysCmdSetStatus, "Afbeelding: '" & [ImageFullPath] & "'." End If Form.Refresh Exit Sub Err_cmdInsertPic_Click: MsgBox Err.Description, vbExclamation End Sub
and here is what is in my module:
Option Compare Database
Public Type OPENFILENAME lpstrTitle As String lpstrFile As String flags As Long lpstrFilter As String
End Type
When I attempt to compile it says Sub or function not defined and highlights MakeFilterString. Why is this and how can I fix it? An ideas? Thank you
Could someone give me a few pointers on how to create a 'Browse' button on a form with the intent to search for an image in an bound-image to record and assign it and store the bmp selected by the user from the user's machine?
i would like to create an browse button on my form so i can find the pictures i would like and then to been shown on the picture field on my form. i tried the northwood code from help but i could manage nothing woth it. do you have any idea to help ,me please??
To start off I have only been working in Access(2003) for the past 2 months. And Yes I am a neebie of all neebies but please read on.
What I am trying to do is for every record I need to associate multiple pictures of damages to items in for repair. For example I have an High end Amplifier that came in for repair and the outside has markings of a fire(thats one pix) then opening it up we see that the fuses, wires and PC board has fire marks also(pix two) and so on. The record is keyed to the serial number. On the form my fields are Serial number, RMA #, all the senders info (name,address, contact number, store purchased, etc.). Then I created a subform for the picture with the following the picture itself, buttons(previous, next, add pic, delete pic) a hiden textbox(serial number) that I have joined(relationship) to the major form(serial number). How do I link the pic to that specific serial number and then other pictures that also link to that serial number.
I know its wordy but I wanted to make it as clear as I could.
I am designing a form and I need to add a Browse button to it. I need the Browse Button to point to the "My Computer". Once that file is selected I need it to fill in the hyperlink box. I have the hyperlink text box on the form and it works if you manually type a link in. I would like it to auto fill-in with the selected file.
Below is a pic of the form I'm having trouble with. the poject is a database of golf courses. there is a form for entering/viewing information for each hole for each course. basically each record has a thumbnail pic of the hole.
That browse button needs to do something. It needs to open a browse dialog box, similar to the browse dialog box you get on many other programs. The idea is that the user selects the picture from the browse dialog box and the file name of this picture is put in the PhotoFile field.
I have no idea where to start on this, but I did check out the Northwind database that comes with Access - its similar but has loads of other functions bundled with it that I don't need and doesn't work without these functions.
I'm no programming genius either! so any help is greatly appreciated. Thanks
I have a field on a form which the user currently has to manually type in the file path to a specific picture on a local drive. After the file path is entered, the path is linked and the picture is shown in an image box. I did this because I didnt want to bog the database down with attached files.
I wondered if I could have a browse button, which when pressed brought up the browse window to allow you to locate the image (using the standard windows browser). Then when you clicked ok, it writes the filename into the correct field on the form.
I have successfully used the recommended way to display images from a folder in a form as posted on the microsoft website.
http://support.microsoft.com/kb/210100/
These instructions were for Access 2000. I noticed that there are seperate instructions for doing this using Access 2003.:
http://support.microsoft.com/kb/285820/
My questions are: 1. If multiple users access this database using different versions of Access (2000 and 2003) will it not work for some? 2. do i have to modify code if i update to 2003?
I need to return a folders directory to a text box on my forms record called Files_Directory when i click the Browse command button... The folder will have more folders within it along with documents all relivant to the folder selected, hense the need for just the folder directory rather than a file.
I'm creating a DB in a public institution and one of the objectives of this DB is to allow a common user to insert images in the same DB. My doubts are:
-Can I do this in a access form, creating a "browse" button? and -How do I associate this application to the field, where the images are going to be stored.
hey... I posted in this forum once to ask how to create a "browse" button... a code was given to me (my thanks to meloncolly) but i search others options and i got this code:
Dim strFilter As String Dim strInputFileName as string
'This code was originally written by Ken Getz. 'It is not to be altered or distributed, 'except as part of an application. 'You are free to use it in any application, 'provided the copyright notice is left unchanged. ' ' Code courtesy of: ' Microsoft Access 95 How-To ' Ken Getz and Paul Litwin ' Waite Group Press, 1996
Type tagOPENFILENAME lStructSize As Long hwndOwner As Long hInstance As Long strFilter As String strCustomFilter As String nMaxCustFilter As Long nFilterIndex As Long strFile As String nMaxFile As Long strFileTitle As String nMaxFileTitle As Long strInitialDir As String strTitle As String Flags As Long nFileOffset As Integer nFileExtension As Integer strDefExt As String lCustData As Long lpfnHook As Long lpTemplateName As String End Type
Declare Function aht_apiGetOpenFileName Lib "comdlg32.dll" _ Alias "GetOpenFileNameA" (OFN As tagOPENFILENAME) As Boolean
Declare Function aht_apiGetSaveFileName Lib "comdlg32.dll" _ Alias "GetSaveFileNameA" (OFN As tagOPENFILENAME) As Boolean Declare Function CommDlgExtendedError Lib "comdlg32.dll" () As Long
Global Const ahtOFN_READONLY = &H1 Global Const ahtOFN_OVERWRITEPROMPT = &H2 Global Const ahtOFN_HIDEREADONLY = &H4 Global Const ahtOFN_NOCHANGEDIR = &H8 Global Const ahtOFN_SHOWHELP = &H10 ' You won't use these. 'Global Const ahtOFN_ENABLEHOOK = &H20 'Global Const ahtOFN_ENABLETEMPLATE = &H40 'Global Const ahtOFN_ENABLETEMPLATEHANDLE = &H80 Global Const ahtOFN_NOVALIDATE = &H100 Global Const ahtOFN_ALLOWMULTISELECT = &H200 Global Const ahtOFN_EXTENSIONDIFFERENT = &H400 Global Const ahtOFN_PATHMUSTEXIST = &H800 Global Const ahtOFN_FILEMUSTEXIST = &H1000 Global Const ahtOFN_CREATEPROMPT = &H2000 Global Const ahtOFN_SHAREAWARE = &H4000 Global Const ahtOFN_NOREADONLYRETURN = &H8000 Global Const ahtOFN_NOTESTFILECREATE = &H10000 Global Const ahtOFN_NONETWORKBUTTON = &H20000 Global Const ahtOFN_NOLONGNAMES = &H40000 ' New for Windows 95 Global Const ahtOFN_EXPLORER = &H80000 Global Const ahtOFN_NODEREFERENCELINKS = &H100000 Global Const ahtOFN_LONGNAMES = &H200000
Function TestIt() Dim strFilter As String Dim lngFlags As Long strFilter = ahtAddFilterItem(strFilter, "Access Files (*.mda, *.mdb)", _ "*.MDA;*.MDB") strFilter = ahtAddFilterItem(strFilter, "dBASE Files (*.dbf)", "*.DBF") strFilter = ahtAddFilterItem(strFilter, "Text Files (*.txt)", "*.TXT") strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*") MsgBox "You selected: " & ahtCommonFileOpenSave(InitialDir:="C:", _ Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _ DialogTitle:="Hello! Open Me!") ' Since you passed in a variable for lngFlags, ' the function places the output flags value in the variable. Debug.Print Hex(lngFlags) End Function
Function GetOpenFile(Optional varDirectory As Variant, _ Optional varTitleForDialog As Variant) As Variant ' Here's an example that gets an Access database name. Dim strFilter As String Dim lngFlags As Long Dim varFileName As Variant ' Specify that the chosen file must already exist, ' don't change directories when you're done ' Also, don't bother displaying ' the read-only box. It'll only confuse people. lngFlags = ahtOFN_FILEMUSTEXIST Or _ ahtOFN_HIDEREADONLY Or ahtOFN_NOCHANGEDIR If IsMissing(varDirectory) Then varDirectory = "" End If If IsMissing(varTitleForDialog) Then varTitleForDialog = "" End If
' Define the filter string and allocate space in the "c" ' string Duplicate this line with changes as necessary for ' more file templates. strFilter = ahtAddFilterItem(strFilter, _ "Access (*.mdb)", "*.MDB;*.MDA") ' Now actually call to get the file name. varFileName = ahtCommonFileOpenSave( _ OpenFile:=True, _ InitialDir:=varDirectory, _ Filter:=strFilter, _ Flags:=lngFlags, _ DialogTitle:=varTitleForDialog) If Not IsNull(varFileName) Then varFileName = TrimNull(varFileName) End If GetOpenFile = varFileName End Function
Function ahtCommonFileOpenSave( _ Optional ByRef Flags As Variant, _ Optional ByVal InitialDir As Variant, _ Optional ByVal Filter As Variant, _ Optional ByVal FilterIndex As Variant, _ Optional ByVal DefaultExt As Variant, _ Optional ByVal FileName As Variant, _ Optional ByVal DialogTitle As Variant, _ Optional ByVal hwnd As Variant, _ Optional ByVal OpenFile As Variant) As Variant ' This is the entry point you'll use to call the common ' file open/save dialog. The parameters are listed ' below, and all are optional. ' ' In: ' Flags: one or more of the ahtOFN_* constants, OR'd together. ' InitialDir: the directory in which to first look ' Filter: a set of file filters, set up by calling ' AddFilterItem. See examples. ' FilterIndex: 1-based integer indicating which filter ' set to use, by default (1 if unspecified) ' DefaultExt: Extension to use if the user doesn't enter one. ' Only useful on file saves. ' FileName: Default value for the file name text box. ' DialogTitle: Title for the dialog. ' hWnd: parent window handle ' OpenFile: Boolean(True=Open File/False=Save As) ' Out: ' Return Value: Either Null or the selected filename Dim OFN As tagOPENFILENAME Dim strFileName As String Dim strFileTitle As String Dim fResult As Boolean ' Give the dialog a caption title. If IsMissing(InitialDir) Then InitialDir = CurDir If IsMissing(Filter) Then Filter = "" If IsMissing(FilterIndex) Then FilterIndex = 1 If IsMissing(Flags) Then Flags = 0& If IsMissing(DefaultExt) Then DefaultExt = "" If IsMissing(FileName) Then FileName = "" If IsMissing(DialogTitle) Then DialogTitle = "" If IsMissing(hwnd) Then hwnd = Application.hWndAccessApp If IsMissing(OpenFile) Then OpenFile = True ' Allocate string space for the returned strings. strFileName = Left(FileName & String(256, 0), 256) strFileTitle = String(256, 0) ' Set up the data structure before you call the function With OFN .lStructSize = Len(OFN) .hwndOwner = hwnd .strFilter = Filter .nFilterIndex = FilterIndex .strFile = strFileName .nMaxFile = Len(strFileName) .strFileTitle = strFileTitle .nMaxFileTitle = Len(strFileTitle) .strTitle = DialogTitle .Flags = Flags .strDefExt = DefaultExt .strInitialDir = InitialDir ' Didn't think most people would want to deal with ' these options. .hInstance = 0 '.strCustomFilter = "" '.nMaxCustFilter = 0 .lpfnHook = 0 'New for NT 4.0 .strCustomFilter = String(255, 0) .nMaxCustFilter = 255 End With ' This will pass the desired data structure to the ' Windows API, which will in turn it uses to display ' the Open/Save As Dialog. If OpenFile Then fResult = aht_apiGetOpenFileName(OFN) Else fResult = aht_apiGetSaveFileName(OFN) End If
' The function call filled in the strFileTitle member ' of the structure. You'll have to write special code ' to retrieve that if you're interested. If fResult Then ' You might care to check the Flags member of the ' structure to get information about the chosen file. ' In this example, if you bothered to pass in a ' value for Flags, we'll fill it in with the outgoing ' Flags value. If Not IsMissing(Flags) Then Flags = OFN.Flags ahtCommonFileOpenSave = TrimNull(OFN.strFile) Else ahtCommonFileOpenSave = vbNullString End If End Function
Function ahtAddFilterItem(strFilter As String, _ strDescription As String, Optional varItem As Variant) As String ' Tack a new chunk onto the file filter. ' That is, take the old value, stick onto it the description, ' (like "Databases"), a null character, the skeleton ' (like "*.mdb;*.mda") and a final null character.
If IsMissing(varItem) Then varItem = "*.*" ahtAddFilterItem = strFilter & _ strDescription & vbNullChar & _ varItem & vbNullChar End Function
Private Function TrimNull(ByVal strItem As String) As String Dim intPos As Integer intPos = InStr(strItem, vbNullChar) If intPos > 0 Then TrimNull = Left(strItem, intPos - 1) Else TrimNull = strItem End If End Function
well what to say... it works... the problem is: the browse window appears and i can select the picture that i what, etc... BUT i don't know how to my selection be inserted in a field already created (object OLE) in a table. so can you help me on this by changing this code or another option... my e-mail: arch.007@gmail.com my Thanks
I need to create a cmd button that lets a user attach a file to record. I would like it to open a msg box that lets the user select the file to be linked to that record. Please help. Thanks.
Alright I give up. I searched the forums and read up but still not grasping it. I know I've done something like this before but my brain must be dead today.
So I have 4 important tables. I have a main one and 3 tables that have records related to the main one. They're all the "many" sides of the one to many relationship with the main table. Outline is below:
Main Table: EMP_ID (Primary key) ...and other fields
So basically what I'm looking for is to have a main form pop up that has the Main table information (employee info). Then on that form I want 3 command buttons, each one going to a new form that relates to the three tables above and is relative to the Main table. Each employee may have several hire/fire listings, insurance listings (if they change their insurance), and skill ratings (updated as they improve). When I have set all my relationships so that the EMP_ID on the Main table has a one to many relationship with all the EMP_IDs on the other tables. When I create the command buttons though and start to populate a record in one of the three "subforms" the EMP_ID is not populating to be the same as the EMP_ID from the main page thus making me unable to create a record because it doesn't recognize a related record.
I'd like to put a button in a form that when clicked opens an image on the computer, the location of which is already specified in a field called RefImage.
When I change the hyperlink property I can only have the button open a folder or internet address rather than a unique image for each individual record.
If I use the code builder for the event on click and try to write Application.FollowHyperlink RefImage it gives me error message 490 that it Cannot Open the Specified File, but this is probably because I don't know how to write VBA.
Any simple way to make a button on a form open an image in IE or windows image viewer which has a path specified within a field of the form? Perhaps someway to use the Application.FollowHyperlink, clearly I am doing something wrong.
I created a form called cptSearch On that form has a list box
What i want to do is when user clicks on cpt in list box and clicks on the edit command button it will open the frm called frmcpt so user can edit details for the specific cpt code
Ok so the Data I have holds a hyperlink to a file this field is "basepath".In Form view I want to have a command button that reads the basepath (for that record) then opens said hyper link.
I have a database setup to keep track of spare parts in my inventory. I want to have a button on my form page that will bring up a file with pictures of the object.
ok, I have links to documents(reportLink) stored as type text in a table (Investigations). Each link is different per record.
I have a form that display information from this table. The field that holds the hyperlink is called reportLink on the form. On this form I would like to have a button that when clicked will open up the [reportLink] for that particular record. so this button will point to a different file each time the record is changed.
I have stumbled around this site and think I have to put the Application.FollowHyperlink code in the OnClick event for this button. However, I am clearly not doing it right as it isnt working. what is wrong with this:
Private Sub Command34_Click() Application.FollowHyperlink Me.[ReportLink]
I have two option buttons, 1_optn and 2_optn. I have two subforms, 1_frm and 2_frm.
When clicking the little round dot (the option button) for 1_optn, I want the subform 1_frm to become visible. Likewise, when clicking 2_optn, I want the subform 2_frm to become visible. In the properties panel, both forms visibility is set to No.
I have tried creating a Macro and the best I've gotten is using the OpenForm function but that opens up the forms in a new window. I'd set the Macro to the OnClick event for a combo box (as I couldn't get the option button to work) so when "1" is clicked, the form would pop up. But they have to be in the same form. No pop ups. It also has to be an option button, not a combo box or list box.It also has to be a Macro. No Event Procedure coding unfortunately.