1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Specific record selected from combobox won't update form

Discussion in 'Business Applications' started by terabacktyl, Dec 19, 2011.

Thread Status:
Not open for further replies.
Advertisement
  1. terabacktyl

    terabacktyl Thread Starter

    Joined:
    Dec 19, 2011
    Messages:
    17
    Hello!

    I am fairly new to Access 2010, but can usually find answers to most of my questions. I have hit a wall here, though:

    I have a combo box in a form that finds a specific record within a query. This query then fills in all the text boxes within the form, which can then be printed from an identical report.

    There is one specific record that when selected from the combo box seems to bypass all the IF statements in my code. I have 10 or so records that have IF statements such that if the carton number = "blah", then label123 will be visible etc. All of the products update the form correctly except for this one.

    However, even if the form does not look as it should, if my "print_record" button is clicked, the report with the same underlying coding shows up correctly. Similarly, if the form is unloaded on this "rebel" record, when reopened it is formatted correctly as well. Unless I choose another record from the combo box, and then choose the "bad" record again.

    The only thing I can think of that is different about this record, is that the field entry in the IF statement necessary for this record includes an asterisk, i.e. 123-4567*. Also, the product name for this record includes quotations, i.e. Brand "Identifier" Type. Though this product name is not used anwhere in the VBA code.

    Please help!
     
  2. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    terabacktyl, welcome to the Forum.
    It is possible that asterix is causing a problem as Access can treat that as a "Wild Card" character.
    If the asterix is an addition to the normal number you could use the left string function to restrict the number of characters that are looked for ie.
    left(me.[comboname], 8)
    where comboname is the actual name of your combo box would restrict it to 123-4567. You would obviously need to apply it to the field that you are "finding" with the combo as well.
     
  3. terabacktyl

    terabacktyl Thread Starter

    Joined:
    Dec 19, 2011
    Messages:
    17
    Thanks for the reply!

    I tried removing the asterisk, and that didn't help. I then took the quotation marks out of the product name, and that fixed it. Do you know why that would have caused this problem?

    Thanks!
     
  4. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Access has always had a problem with single quote marks when using combos, I am not sure about the double quotes.
    Or were the double quotes in the VBA code?
     
  5. terabacktyl

    terabacktyl Thread Starter

    Joined:
    Dec 19, 2011
    Messages:
    17
    The double quotes were in the field Product Name as: Brand "Type" Bar
    Then I referenced this field in the VBA code as:

    If Case = 310-0500* Then (Which was only the case for the item mentioned above)
    Label1.Visible = False
    Else
    Label1.Visible = True
    End If

    The product name using quotations is never written in the VBA code, so I don't know what the problem is. It's just for some reason this code, along with multiple other if statements, wouldn't fire after the form's combo box was updated to this item.
     
  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Similar Threads - Solved Specific record
  1. Battlesoaked
    Replies:
    1
    Views:
    395
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1031967

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice