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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Message Box Reporting Variables

Status
Not open for further replies.

roxannep

Technical User
Jun 20, 2000
69
0
0
Situation: Currently have a form that user inputs inventory item data in unbound boxes, including one indicating how many times to duplicate the item. These items are sold singlely in various locations at various times and must be tracked individually with their own unique identifier. To expediate data entry, the form also requests how many of these records to create. The user enters the variable, and the code then makes X number of identical records with the exception of the identifier it automatically adds. This identifier is different from the auto record number.

The user then needs to know the starting identifier and the ending identifier. We want a window to come up stating something like:
"The 15 records you just added are file nos.
B1156 through B1171."

What is the best way to code this or have this happen before the user moves on to the next item to enter?
 
Assuming that you have ( or can manage to get ) three variable containing the values you want .. ..

eg
Dim intCount As Integer
Dim strFirstCode As String
Dim strLastCode As String

' Then some how you get to know ..
intCount = 15
strFirstCode = "B1156"
strLastCode = "B1171"

MsgBox "The " & intCount & " records you just added are file nos. " & strFistCode & " through to " & strLastCode , , "Title text for msgbox"


'ope-that-'elps

G LS

 
Thanks for such a fast reply. I should have been clearer ... I know about how to make the message come up and where to plug in the strings ... it's how to get those variables to plug in that I need an assist with (the file nos. based on the variable "number of records" just created by the user ... in this example I've been using 15).

Anyone have an idea?

 
Well, you've got the first index number - that's just a matter of looking up the last record, then strip off the leading alpha character(s)

strNumber = Right(strIndex,Len(strIndex)-1)
strPrefix = Left(strIndex,1)
'convert strNumber to a number
intNumber = CInt(strNumber)
strFinalIndex = strPrefix & Trim(CStr(intNumber+RecordsToAdd)


You'll have to add a loop if the prefix could be > 1 alpha char.
Also if the number has leading zeros in the Index you'll need to add the zeros back in, as in :-
strFinalIndex = strPrefix & strZeros & Trim(CStr(intNumber+RecordsToAdd)
where strZeros is a string of the right number of "0" chars.


G LS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top