Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'Jump Down' to next record when currencay value filled in full

Status
Not open for further replies.

BillAsl

Technical User
Aug 28, 2002
7
GB
Hi Guys
Been reading lots of good comments, tips and solutions so wondered if you may be able to help me with this prob. I am not a novice but I am not a fully fledged programmer either so be gentle with me, lol.
I have a form 'frmBDMSales' with a text field 'event' that has three types of value entered into it, 'NA', 'NO' and '12.01', the last one can be any value to two digits as it represents money. The van sales person uses NA for not available, NO for no answer and a value for a sale. In order to make it simple for the user they only wanted one field to enter data into so I had to use text ( I think ). I have used autokeys to produce NA and NO and add a carriage return after to move to the next field to be input but am lost as to how to do this when a value with a decimal point and two digits after is typed in. The aim is as soon as they have placed the decimal point some how I count for 2 more digits and then move to the next record automatically.

Does anyone have any ideas that may help, and sorry but I need them in a hurry if poss..

Thanks in anticipation, and even if not, great site thanks.

BA
always hopeful, always learning
 
create an invisible, unbound text box.

In the OnEnter event for the textbox which is going to get the NA, NO or money, set the value of the invisible text box to 0.

In the key up event for the text box into which the NO etc is being entered do something like this:

InvisibleTextbox = InvisibleTextbox + 1
If InvisibleTextbox = 2 Then
If DataEntryBox = "NO" or DataEntryBox = "NA" Then
setfocus on the next textbox to be used
End If
End If

If InvisibleTextbox = 5
setfocus on the next textbox to be used
End If


Check HELP for the correct syntax of the setfocus command.
 
Of course, the following would give you both a check for an invalid entry and automatically place the decimal point.
If InvisibleTextbox = 2 Then
Select Case DataEntryBox
Case "NO"
setfocus on the next textbox to be used
Case "NA"
setfocus on the next textbox to be used
Case Between 01 and 99
dataEntryBox = dataEntrybox & "."
InvisibleTextBox = 3
Case Else
messagebox with nastygram telling them that they have entered an invalid value.
End Select

If DataEntryBox = "NO" or DataEntryBox = "NA" Then
setfocus on the next textbox to be used
End If
End If

 
Thanks Grnzbra

Will try that now

Cool

Bill
 
Hi
Cant seem to get it to work, not sure if it is me.
I have a field I have called 'entry', that is your DataEntryBox and I have created a textbox unbound and called it InvisibleTextbox just to try it out. But cant seem to get it to go, any ideas

and thanks so much for your help

Bill
 
Does it compile? The second solution might not; i think it's missing an end if statement. If it compiles, put in a breakpoint in the first line of each of the two events and step through to find out where it's blowing up.

If you are trying the second solution, go to the first. I'm not sure if the case statement will work looking for both text and a range of numbers.

Basically, the idea is to check after the second keystroke for either of the two text values, a pair of numbers or some other pair of letters. If the select case is having trouble handling the between 01 and 99, you might want to dim AlphaToNumber as Integer
and run the select case as

Case "NO"
same
Case "NA"
same
Case Else
OnError Go to InvalidInputError
AlphaToNumber = DataEntryBox
dataEntryBox = dataEntrybox & "."
InvisibleTextBox = 3
End Select


InvalidInputError:
messagebox with nastygram saying invalid entry
blank the data entry textbox.
set the counter back to 0
set the focus on

What's going on here is after checking for one of the two desired alpha inputs and not getting them, you try to move whatever value it is into an integer variable. if it goes, continue on (you don't do anything with the ingeger variable other than to see if it causes an error. If it does, fire off nastygram, blank out the text box, reset counter and start again. if no error is caused, you have a numeric value. concatinate a decimal point, change coutner to 3 and continue.
 
Oh yeah, leave the invisible text box visible until you get this to work. Knowing what's going on in it might be helpful
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top