Results 1 to 6 of 6
  1. #1
    fountain27 is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Apr 2019
    Posts
    25

    Stupid Question - ComboBox Results in a Calculated Filed

    I apologize in advance as it has been awhile size I worked in Access. I have a combobox to choose the size of an Advertisement (0.5, .333, .25 etc). I now want to multiply the Ad Size by the quantity to get Ad Pages. However, the combobox displays the correct Ad Size, but returns the row number from the table. I thought it had to do with the Bound Column, but I cannot figure it out.



    Can someone point me in the right direction?

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Can you post a copy of your db

    If not, can you show us what you have for the RowSource property of the combo box and also the property settings for:
    Bound Column
    Column Count
    Column Widths
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    fountain27 is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Apr 2019
    Posts
    25
    Click image for larger version. 

Name:	Screen Shot 2020-01-23 copy.jpg 
Views:	14 
Size:	23.1 KB 
ID:	40733Click image for larger version. 

Name:	Screen Shot 2020-01-23(2) copy.jpg 
Views:	14 
Size:	70.4 KB 
ID:	40734

    Here are the two screen shots of the Property Sheet for ComboBox Ad Size.

    I know the data is being stored as the Row #, but Displays the item in the Column 2 which is exactly what I want. But I need the actual number to calculate the total ad pages. One Half-Page Ad (0.5) and Qty (1) is 0.5 Ad Pages Total. etc

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    You can refer to the value of any column in the combo box, even if the column is hidden by having it's width set to 0, by using a bracketed number which represents which column is required, counting from the left. The count is zero based, so the first column would be (0), the second would be (1) etc. In a textbox on your form, you could refer to the column which has the data for [Ad Size] with an expression something like:
    =[Ad Size].Column(1)
    The [Ad Size] in the expression above refers to the name of the combo box, not the name of the field required.
    If required you could use the expression to create a calculation, maybe something like:
    =[Ad Size].Column(1) * [Qty]
    where [Qty] would be the name of another control (text box) on the form.
    HTH
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    fountain27 is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Apr 2019
    Posts
    25
    Thank you so much!

  6. #6
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Quote Originally Posted by fountain27 View Post
    Thank you so much!
    I'm glad that you found my comments useful. I have another for you that I forgot to mention in my original reply.

    You would be well advised to NOT use spaces in the names you give to objects (Tables, Fields, Controls etc etc). Objects with spaces in their names MUST be enclosed with square brackets [] as I did in the expressions I gave you earlier. Apart from the extra typing required you will cause yourself a problem at some point in the future when you forget to use them. And believe me, that will happen .

    For example:

    Don't use: [My Object Name]
    Use: MyObjectName
    Or: My_Object_Name
    Last edited by Bob Fitz; 01-24-2020 at 02:23 AM. Reason: More Inf
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Calculated filed in Access 2007
    By fekrinejat in forum Access
    Replies: 6
    Last Post: 02-05-2013, 07:54 PM
  2. Maybe a stupid question
    By rbiggs in forum Programming
    Replies: 1
    Last Post: 08-23-2011, 05:29 PM
  3. Stupid Question
    By ellixer in forum Queries
    Replies: 1
    Last Post: 06-30-2011, 09:33 AM
  4. Stupid Question ?
    By nood in forum Forms
    Replies: 3
    Last Post: 09-29-2010, 07:54 AM
  5. newbie has stupid question
    By Bruzer in forum Access
    Replies: 3
    Last Post: 04-05-2010, 12:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums