Results 1 to 14 of 14
  1. #1
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

    If Statement,Change CheckBox,Use Same Supplier

    I am trying to figure out a way so that if a user checks Option Group,(Check55 or Check57) then it will allow them to use the same supplier for every item purchased or else individually select a supplier for each item purchased. Of course I would need a vb yes/no to ask them what they wanted to do.Where should this code fire from? When they first select a product, i.e. ProductID or when they choose a Supplier for the first time?
    Form name is CompanyOrderSubform


    Check55 would be the YES, use same Supplier for every order. The default is No. Check57


    Supplier is the bound control on the form
    OptionGroup is unbound. Frame52
    Attached Thumbnails Attached Thumbnails SameSupplier.jpg  

  2. #2
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    In the after update event for the check box, you might include an IF-then -else statement.

    for the true, you could then insert some code that is similar to this

    Code:
    Private Sub copyrecordbutton_Click()
    On Error GoTo Err_copyrecordbutton_Click
    Dim pown As Variant
    Dim psource As Variant
    Dim pclient As Variant
    Dim ptax As Variant
    pown = txtcurrent1.Value
    psource = txtcurrent2.Value
    pclient = txtcurrent3.Value
    ptax = txtcurrent4.Value
    RunCommand acCmdRecordsGoToNew
    txtnew1.Value = pown
    txt2new.Value = psource
    txtnew3.Value = pclient
    txtnew4.Value = ptax
    Exit_copyrecordbutton_Click:
    Exit Sub
    Err_copyrecordbutton_Click:
    MsgBox Err.Description
    Resume Exit_copyrecordbutton_Click
    change the control names to meet you particular situation

  3. #3
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    So, since I use Frame52 and the option buttons are named 55 and 57, this is where I am at right now.
    I assume the ONLY way this would work is for them to first select a Supplier? Yes/No ?

    'SameSuppliermsgbox = MsgBox("Would You Like To Use Same Supplier For Entire Order?", vbInformation + vbYesNo, "CompanyOrderSubform")

    If (SameSuppliermsgbox = vbYes) Then
    DoCmd.SetWarnings False

    If Me.Frame52 = 1 Then
    Me.Supplier = 'Supplier Selected
    Else
    Me.Supplier = ""
    End If
    End Sub

  4. #4
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Have you tested? And does it give you expected results?

  5. #5
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Yes, it helped but the code lost me. I will mark as resolved just as soon as I can make it work,

    Thanks,

    I am afraid my Access skills are not up to par, Sorry!

  6. #6
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Which code lost you? What needs to be explained? We are here to help and teach.

    Alan

  7. #7
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Unfortunately, Don't know how, I got stopped with a Join Error Message. I can't seem to get my 2 forms working, it's either one or the other.
    One is for Buying products and the other Selling Products. Of course they both use the same Products table.

    Anyway, i will get back to you on this challenge after the fires are put out on the other issue.

    Thanks for your help and patience.

  8. #8
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    If both forms are bound to the same table, then why not have the information on one form?

  9. #9
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    I originally tried having everything on one form but then it occurred to me that they would probably need to choose another Company/Customer for the next order and there is where it would get too crazy! Sounded good in theory tough. Example: The Company wanted to SELL products and then created a order on the form, but then a Customer needed to BUY products, can't do on the same form that I know of! Then you run thru the whole tabbed menu thing which can get confusing!
    I am confused myself. So I have decided to split the db and link just some common tables between them and isolate any problems.

    I will get back with you when I am through and see if it gets fixed.

    Thanks,

  10. #10
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    I finally got to try the code, it gave me a error message; Object Required. I even had a supplier filled in already.???

  11. #11
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    You may want to upload your db for analysis.

  12. #12
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Thanks, I did upload it but forgot one macro to update the price when selecting a product.

    Thanks so much!

  13. #13
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Where did you upload, there are no attachments in this thread.

  14. #14
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

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

Similar Threads

  1. If Statement, Need to change value to 0
    By burrina in forum Access
    Replies: 5
    Last Post: 11-02-2012, 08:40 AM
  2. Detailed Inventory / Supplier DB
    By gwallace1 in forum Database Design
    Replies: 1
    Last Post: 06-27-2012, 05:31 PM
  3. Supplier Accounts Case Study
    By jimmy321go in forum Access
    Replies: 1
    Last Post: 05-02-2012, 08:46 AM
  4. Replies: 3
    Last Post: 09-08-2011, 10:53 AM
  5. change values after checkbox "YES"
    By DonLduk in forum Forms
    Replies: 1
    Last Post: 10-03-2008, 04:47 AM

Tags for this Thread

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