Advertisement

02.02.2008 at 12:12PM PST, ID: 23132292
[x]
Attachment Details

Continuous form update

Asked by Dan89 in Access Forms, Microsoft Access Database, Database

Tags: , ,

Hi all, I am using a continuous form to make a quote builder, quotes are built up of different items, the user selects an item from a combo box and then enters the quantity of that item. Another combo box then appears and the process is repeated until all items have been entered. The information is saved into a table. In the combo box I have included a blank option so that in the case the user accidently selects one item too many, they can re-choose the blank option so the record can be deleted using an action query that simply looks for record that have null values and deletes them. The SQL statement I am using for the row source is:
SELECT [ItemID], [ProductName], [Description], [SaleCost]  FROM Stock  UNION SELECT Null AS [ItemID], Null AS [ProductName], Null AS [Description], Null AS [SaleCost]  FROM Stock
ORDER BY [ProductName];
Usually when a normal option is selected an input box appears asking for a quantity, cost is entered automatically. Description is just for reference and is not saved. When the blank record is selected what I want to happen is for no input box to appear (this works) then for the record to be deleted using the query or otherwise, then for the form to be refreshed so that the combo box is removed from the form. What happens currently is that I select the blank option, no input box appears but the record is not deleted, if I then select the blank option a second time, the record is deleted but the form is not refreshed, if I then hit the refresh button,  the combo box disappears, clearly this is semi-working. The code I am using to do this is:
Private Sub cmbItems_AfterUpdate()
If [cmbItems].Value > 0 Then
    [Price] = [cmbItems].Column(3)
    [Qty] = InputBox("Enter in Quantity", "Quantity", 1)
    DoCmd.Save
Else
    DoCmd.Save
    DoCmd.OpenQuery "qryDeleteNull"
    Me.Refresh
    Exit Sub
End If
End Sub
Can anybody suggest an idea that would complete this code to make the process fully functional?
Many thanks
Dan
Start Free Trial
[+][-]02.02.2008 at 04:16PM PST, ID: 20806641

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]02.02.2008 at 04:51PM PST, ID: 20806772

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Access Forms, Microsoft Access Database, Database
Tags: Microsoft, Access, 2007
Sign Up Now!
Solution Provided By: Dan89
Participating Experts: 1
Solution Grade: A
 
 
[+][-]02.03.2008 at 02:38AM PST, ID: 20808398

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628