Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How return user to input box

Posted on 2013-01-19
4
Medium Priority
?
272 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 48

Expert Comment

by:Dale Fye
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 2000 total points
ID: 38798779
Just set the focus back to the combo box, like this:

Me![cboPart_no].SetFocus
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

670 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