Solved

How return user to input box

Posted on 2013-01-19
4
264 Views
Last Modified: 2015-01-05
On a form I have a combobox named "cboPart_No". The after update event does this:

    'Display message box to warn user that excess inventory exists for this part number and allow for applied inventory qty ...
     If DSum("[Qty]", "tblFinGoods", "[PartN] = '" & Me.cboPart_No & "'") > 0 Then
        txtAppliedInvQty = InputBox("Excess inventory exists for this part number. Qty = " & (DSum("[Qty]", "tblFinGoods", "[PartN] = '" & Me.cboPart_No & "'") & " .  Enter the qty you want to apply to this order: (Be careful to enter the exact amount)"))
   
    'Alert if applied qty is greater than available qty...
        If Me.txtAppliedInvQty > (DSum("[Qty]", "tblFinGoods", "[PartN] = '" & Me.cboPart_No & "'")) Then
            MsgBox "You have entered a quantity greater than the available quantity.  Please correct the entry."
        End If

If the user enters a value greater than the DSum value I want them to be returned to the combobox AFTER the message telling them they haver a bad number, (the 2nd if...then statement), with the combobox blanked out.

What code do I need to do this?

--Steve
0
Comment
Question by:SteveL13
4 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 38796572
You say that this code is in the afterupdate event procedure of the Part_no combo?

It looks like it ought to be attached to the quantity field?

And you want to go back to the Part_no combo if the quantity is wrong?

Can you just confirm this please.
0
 

Author Comment

by:SteveL13
ID: 38796859
This is correct.
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 38797376
I'm on my iPad so I'm going to abbreviate this

If dsum() >0 then

    Do

        X = input box

        If x <= dsum () then exit do

        Msgbox

Loop
0
 
LVL 31

Accepted Solution

by:
Helen_Feddema earned 500 total points
ID: 38798779
Just set the focus back to the combo box, like this:

Me![cboPart_no].SetFocus
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question