Results 1 to 4 of 4

Thread: Combo Box

  1. #1
    Join Date
    May 2009
    Posts
    72

    Unanswered: Combo Box

    Hi everybody
    I have a combobox which shows a list of items that need billing
    i want the item to be removed off the combobox once it is billed.
    any help
    thanks in advance
    krishnanhemanth

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    In the underlying table that's used to hold the data of the ComboBox, have a Bolean column [Billed]. Base your combo on a query or SQL sentence with a Where clause : SELECT... WHERE [Billed] = False.

    Each time you "bill" an item, set the [Billed] value of that record to True and requery the combo.

    Have a nice day!

  3. #3
    Join Date
    May 2009
    Posts
    72

    dynamic update of combobox

    thanks for the reply
    your idea seems promising.
    could you help me out in where clause statement.

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    1) I have a table Tbl_Billings :
    SysCounter, Long Integer, AutoNumber, Primary key
    FK_Sales, Long Integer
    Date_Of_Billing, Date/Time
    Billed, Yes/No, Default value = 0
    FK_Sales is a foreing key that points to a Tbl_Sales table that contains the sales data.

    2) I have a form Frm_Billings with a combo Combo_Billings and a command button Button_BillIt. The RowSource property of the combo is set to:
    Code:
    SELECT FK_Sales FROM Tbl_Billings WHERE Billed=False;
    3) When I click the Button_BillIt command button the following code is executed:
    Code:
    Private Sub Button_BillIt_Click()
    
        Dim strSQL As String   
        '
        ' Do what is necessary for billing a sale
        ' (create an invoice etc.).
        '
        ' ---< Code for billing a sale comes here.>---
        '
        ' Timestamp and mark the newly processed sale as billed
        ' in the tbl_Billings table and adjust the combo accordingly.
        '
        strSQL = "UPDATE Tbl_Billings " & _
            "SET Billed = True, Date_Of_Billing = #" & Date & "#" & _
            "WHERE SysCounter = " & Me.Combo_Sales.Value
        CurrentDb.Execute strSQL, dbSeeChanges  
        Me.Combo_Billings.Requery
        Me.Combo_Billings.Value = Null
        
    End Sub
    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •