I am trying to show an image on a form based on a user choice from a drop down box. For example, the user needs to choose a priority for a task. If the user chooses "Immediate" I want an image of an exclamation point to show up to draw attention that this is important.
I have a continuous subform which queries a table of attachments. I'm using Access 2007 but not using the Attachment datatype; this DB will grow considerably and I don't want to waste precious space by filling it with bulky files. So instead, I have code which makes a copy of the attachment and adds the hyperlink (to the copy) to the table instead.
Now - I want to add a control to the subform to display an icon / image reflecting the file type of the attachment (Word doc, Excel s/s, PDF etc.)
But not sure how to go about it.
I was thinking I could use FileSystemObject.GetFileExtension at the point in the code where the attachment is added, and add a new field to my attachments table (i.e. translate "*.xls*" to "Excel", etc.) Then store / embed a handful of images for the core types I would expect and use an image control on the subform to display the image based on the value of that field.
But is that even possible / feasible?
Or, is there a handy API which can retrieve the icon associated with a file type based on what has been installed on the local machine (even if there is, there's still the problem of setting up the image control to display the appropriate icon specific to each record...)
Or, is there another control available which would be better suited to something like this than an Image control?
I'm working on a wine database (for ages now...). I'm currently struggling getting the following to work. I have a form in which one can select the name and vintage of a wine using a combo box, after which also a picture will be shown of that wine. I have the pictures as attachments in a table. One can then press a button to close this form and go to another form in which one can edit all the details of the selected wine. Problem: I can't get the picture to show.
I have a reasonably simple form with a combo box, a text box, a button and an attachment field in which a picture should show.
I made a query to select the id, name and vintage from the wine table. I couldn't select the attachment field for the pic in the wizard, so I added that myself in the Design View. The Query for the combo box now reads:
Code: SELECT Wijn.Id, Wijn.Naam, Wijn.Vintage, Wijn.Plaatje FROM Wijn ORDER BY Wijn.[Naam], Wijn.[Vintage]; (translation: Naam = name | Plaatje = picture)
It neatly shows name and vintage in the drop down list. Once selected it only shows the name of the wine in the combo box and I use VBA to fill the Text Box with the vintage of the selected wine. The VBA I use is:
Code: Private Sub cmbNaamWijn_Change() Me.txtVintage.Value = Me.cmbNaamWijn.Column(2) End Sub
All works fine. Also when I pres the button, the wine I selected opens up and can be editted and the select form nicely closes. The only problem is the fact that I cannot get the picture to show!
I inserted an attachment field with the name: attImage. In the VBA code I added the line:
Doesn't work. With debugging I do see it gets the correct value form the table. I get an error message stating "Method or data member not found", so Picture is not available for the attachment object I guess. If I look at what is available, I can't select anything useful. So my next try was adding an image control with the name: ImageWine and the VBA code in the On Change property
Code:
Me.ImageWine.Picture = Me.cmbNaamWijn.Column(3)
results in the following: Run-time error '2220'. Microsoft Access can't open the file '[FilenamePicture]'. Logical in a way I guess, since there's no path in there. I also tried the Bound Object Frame, but that resulted in the same problem as the attachment try described above.
I have a piece of code that I'm using to display an image on a report based on a path saved to each record. the code is:
Code: Option Compare Database Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) If IsNull(Me.ImagePath) Then Me.ImgPic.Picture = "O:BellinghamIntranetProductionLabelsNo Label.bmp" Else Me.ImgPic.Picture = Me.ImagePath End If End Sub
It seems like every few months the code crashes access and then never works again. When I debug, the part that is highlighted is:
Code: Me.ImgPic.Picture = Me.ImagePath
The only way i've found to correct it is to delete the report and the module and copy them back in from a backup database. What could be causing this code to crash or how to stabalize my database to prevent this from happening again.
In my database I have a table that keeps track of a package of items. The package is assigned a package type (counter display, end cap, half pallet, full pallet for example). The record of the association of the package and it's type is held in the main table.
Each of these package types is either a case or a pallet (counter display and end cap are cases and half and full pallets are pallets) This relationship is kept in another table (we will call it description table).
Now, based on the type of package and therefore it being a case or pallet a UPC and a GTIN number are assigned. The GTIN number is different if it is a case or is a pallet. I have a table that stores all of the UPC and GTIN numbers available in 3 columns, one for UPC, one for GTIN Case and one for GTIN Pallet (the UPC is a standard 12 digit and the GTINs are 14 digit -with the first 2 different to designate pallet or case. and all are based on the check digit formula necessary)
The user assigns the UPC and correct GTIN number by clicking a button which applies the next available UPC code to the package and determines if the description of the type (case or pallet) and inserts correct GTIN number into that field. I actually have all of this functioning correctly.
Now the problem. If a user changes the package type, and therefore changes the description, I need to add code to the update event of the combo box that gives the choices for package type that does the following:
Check to see if the original package type was a case or pallet (it's description) and if by changing the package type it is now changed to the other, update the record in the main table to the correct GTIN number based on the existing UPC Code.
OR as I write this, maybe the code could simply update the main table with the correct GTIN code based on the new description and the existing UPC code. This was I would not need to check for a change just do the update every time.
I know that Access can display images, I have seen it done. I am using Access 2013. I am trying to display a photo in a form field. In the underlying table I have tried using attachment and OLE Object data types and I couldn't get the picture to display with either.
I have two tables, tblAdmin (which contains my attachment field, a logo) and tblRecords (which contains customer records.I created a form (frmMain) that displays customer records, and hooked frmMain to qrySelectCustomer, which is a query that... you guessed it!... selects a particular customer to view. I wanted the logo to appear at the top of this form, but it's in a separate table. I need to allow the database owner to go in and swap out one logo for another whenever he wants (if the business changes or whatever) and all my subsequent forms/reports have to pull this logo.
I can't use any kind of DLookUp for the image/attachment, because DLookUp only fetches text not images, so what I did was create a subform called frmLogo and hooked the subform to tblAdmin where the attachment resides. It works perfectly when I just open the frmLogo, the image displays as it should. But when I open frmMain, I get a parameter value prompt because it can't find the image! Even though the subform frmLogo that's on frmMain is hooked to the correct frmAdmin table!
I tried several things, but the only thing that solved the problem was to ALSO hook frmMain to tblAdmin, which I do NOT want to do, because then I have to create a THIRD form for the customer data and hook THAT to qrySelectCustomer!
I have an image within the attachment field on a table.The particular table is not linked with the data within the report.I tried to use DLookup but found it only showed the picture name i.e. signature.png..How can I display an image (in fact the only image) in the attachement field on another table within the report?
I'm currently making a form to display employee info in a nice fashion..
Anyway I have the employee photo displayed in an image control.
I want to be able to apply some tricks to the borders to make it look better. To do that, I need to make the width property equal to the width of the actual image while the height is restrained
I have a text box [txtTrafficValue] that is a calculated field of two short times. I want an image to be visible if the value is >= 0.0104 (15 minutes). I have in the after update of the field:
if me.txtTrafficValue >= 0.0104 Then Me.imgWarning.visible = true Else Me.imgWarning.visible = false End if
but when the field does the calculation and updates the image is not appearing.
I have been looking some information on changing image based on form combo box selection on form.
I manage to do case by case but i need it in a simple code because their will be many employees just to avoid adding case by case code for each one.
Private Sub Emp_IDCombo_AfterUpdate() Select Case Emp_IDCombo.Value Case "AM-001" Imageholder.Picture = "C:UsersAMGDesktopam-001.jpg" Case "AM-002" Imageholder.Picture = "C:UsersAMGOne DocumentsHR & Admin DatabaseEmployee Picturesam-002.jpg" End Select
I have employees table where all images location is saved in text field and i have a combo box on form which is employee id.
Tables relationship Employees_table [PK] to Contracts_table [FK] via field name {emp_ID}
Fields Name Combo Box name on form Emp_IDCombo and row source is SELECT Employees_table.Emp_ID, Employees_table.EmployeeName, Employees_table.Emp_Pics FROM Employees_table;
Text field is located in employees_table called [Emp_Pic] for images location.
I have a main form containing client details (tbl_Client) and a sub form containing notes (tbl_notes). tbl_Notes contains a foreign key field (Client_ID) which is obviously the primary key in tbl_Client.
The client is chosen on the main form using a combo box where the user selects the clients name. the id is not visable to the user. How can i get it so that the id (Client_ID) of the selected user is inserted into the Client_ID field of tbl_notes.
I would like to run a simple select query, where the CRITERIA is based on the user choice. I have a form with a combo box, with a few choices, and a button that will trigger a macro with one query for now. I can store the choice in to a variable e.g. "town", using Microsoft VB code. How can I transfer the variable to the CRITERIA field in the query, so whenever I chose a specific "town", my query will select the records for that specific town. I want to use one query, and I don't want to have to "hard type the criteria in to the cells' query", but I would like to use a variable that can change and will be read it from the user choice through combo box.
I have continuous form in Access 2010 and I would like when user will click on record, the image, for instance, imgTest become visible for that record. But for other records the image not visible. How it to do?
Hi I have been searching this forum for 3 hours for a solution, some come close others are pure gobble de gook to me. I have on a form 1 combobox where a name is chosen, from that choice I would like the address, suburb, state etc automatically placed intheir relevant fields. I have tried =DLookUp("[PropertyAddress]","tblProperty","[Property]") in the address textbox which will only bring up the first recod's address from the table, if I change the name in the combobox the address doesn't change. What am I doing wrong, I have designing databases in Access for a total of 7 days now and have been going fairly well with some tips and code snippets from this forum but this has got me stumped.
Per the instructions detailed here... http://www.fontstuff.com/access/acctut08.htm
...I created a parameter query in the form of a drop down box that, once an option is selected, should display a form with a number of fields pre-filled from a record chosen by the drop-down selection.
The drop down has a command button with the following code in the Onclick event:
Private Sub cmdCreateReport_Click() DoCmd.OpenQuery "qryUIRFollowUp", acViewNormal, acEdit DoCmd.Close acForm, "frmOpenUIRLookUp"
As it now stands when I click the button I get the form but none of the selected data is filled in. The fields are blank.
What code to I need to add to the above to make the form hold the data selected from the drop down?
I have a query with a Date field for EndDate (the dates for end-of-week, Fridays in our case) and another field for Sales (number of sales, not dollars).I want to add 4 calculated fields that represent weeks and have the Sales appear in the correct column (field) for that date.So I will have columns for 10 July 15, 17 July 15, 24 July 15 and 31 July 15 and I want the Sales for each record to land in the correct date column, based on the EndDate column. (The 4 fields is just for the sake of the example, I will actually be having dozens of these calculated date fields).I tried to do it by setting up the 4 calculated fields like:
10Jul15: Sales and then adding Criteria like: EndDate = #10/07/2015# It doesnt work.
I have a Table with 57 fields. I would like to display this table in a form as a subform, but only certain fields depending on what selection is made in a combo box.
For instance, if the user selects "Missing Information" in the Combo Box, then the form will show a few standard fields such as ID, Market, Sales Manager, and then some specific ones such as date missing information requested and date missing information received.
If the user selects another option, again the standard fields will remain plus a few different ones.
I have done much searching on this and feel like I am so close but so far. I have looked into controlling the record source of the subform, columhidden =false and a multitude of others. All of which may or in fact probably do work in this situation but I can't seem to put it all together.
I have created a form with 3 subforms on. i was just wondering is it possible to display/ hide these subforms based on a Yes/No field in the form. as the subforms would only be valid if the field is ticked as yes.
I have developed a form which contains a subform. The subform contains a bound image for display. Think of a 'department' form with 'employee' records on the subform containing an employee photo. (Very standard stuff.) It used to work correctly but I must have inadvertantly changed something but cant find it.
The problem is that the photos don't display at all as I move through the department records - using the main form's navigation. I need to use the subform navigation to show any of the photos. When I get a photo to show for a particular department then I can navigate through all the employees in that department and their photos display correctly. (If I run the subform separately then the photos display correctly too.)
I have a lengthy CASE statement in my database that displays specific text in a field based on the value of another. Simple stuff but for some reason it randomly will not work on certain values, and never the same one twice. Is there a commonly known cause for this? I have verified that the spelling and spacing etc. are correct in my code so that shouldn't be causing the problem.
I designed a simple form that has a listbox and a subform. I am using Northwind database for testing.
I would like to be able to display on a subform only records based on a value of a list box.
I created a listbox using a wizard and selected an option 'find a record on my form based on the value I selected in my list box'. This kind of works but it does not display all records matching criteria.
Attached print screen 1 shows my table and there are six records for 'Las Vegas' but my sub-form displays only three for Karen Toh (print screen 2) and all records for John Edwards are missing. I am not really sure how to fix this problem.
Ideally I would like to take this a step further and do another list box with Last Name and then filter data even further down so for example if I select Last Vegas and Edwards then the form would show me only matching records.
Is there a way to make a form that will display all records based on a single date, at the same time, in the same format each and every time?I have a table which has the following fields:
ID (Autonumber, PK) ServiceDate RunningNumber BonnetNumber Deallocate (yes/no)
Now, I would quite like to keep the form in a style similar to all the others I have, not least as I have to cater for users of all age and abilities, so keeping things as simple. I have attached an image - each row to represent a record basically, I would like the form to open and show the same layout on each day (I would place the textboxes etc in route groups); a null value would not be allowed for at least one field in each record, I could force the records to populate the form in the same way each day?