Solved

How return user to input box

Posted on 2013-01-19
4
267 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 (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

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
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…

710 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