Solved

How return user to input box

Posted on 2013-01-19
4
268 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 500 total points
ID: 38798779
Just set the focus back to the combo box, like this:

Me![cboPart_no].SetFocus
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

632 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