473,396 Members | 2,014 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

check content in textbox.

101 100+
Hi,
My project is in MS Access 2002.
In that I have two forms which I am using for Shipping Entry.
Now First Form(ShippingAlerts) Is fillup by persons working in customer services.and the Second Form(ShippingEntry) is fillup by workers operating Hi-Low machines to put Boxes in Trucks.

Now In First Form(ShippingAlerts)I have some fields like
AutoNo,BillToAddress,ShipToAddress. and some other like
CustomerCode,ItemNo,PONo,LONo,PalletNo etc.all fields in this line are dependent fields.
AutoNo is automatically generated.and allocated to one ShippingAlert Form at a time.
Now in that Form when person select Customer from CustomerCode(ComboBox) then it will generate list for another ComboBox(ItemNo).Now when person select Item form ItemNo(ComboBox) then it will generate list for PONo(multiple select ListBox).same thing happen when select PONo(multiple select ListBox) then generate list for LONo(multiple select ListBox).and when select LONo(multiple select LIstBox) then generate list for PalletNo(multiple select ListBox).Now person have to choose which PalletNo he has to ship from that list.when he select mutiple PalletNo from list then it will automatically enter in new TextBox(FinalPalletNo).in that value is like this
24914;24913;24912;24905;23105;;23205.
Here I used ";" to seperate PalletNos.and sometimes there is no PalletNo then it will be like ";;" as I shown in upper line.

Now In Second Form(ShippingEntry) person working on machine has to select AutoNo of First Form(ShippingAlerts).So it will automatically fill some fields from that form.like
BillToAddress,ShipToAddress And value TextBox(FianlPalletNo) allocated to Another TextBox(PalletNo) on this form.
Now person working on machine scan the barcode of PalletNo and automatically it will enter data regarding that PalletNo in form.At the same time I want to higlight the same PalletNo in that TextBox(PalletNo).So person will know which PalletNo are remainng and which already done.I can do this thing if single value in TextBox(PalletNo).But there is value like this
24914;24913;24912;24905;23105;;23205
So I don't Know hos to seperate it


Anyone have solution to this problem then plz give me.
Thanks.
Feb 26 '08 #1
7 2831
Stewart Ross
2,545 Expert Mod 2GB
Hi Billa856. I have provided two functions for you which can help with your multiple pallet number problem. The first, CountValues, returns the number of pallet numbers contained in the entry string (the value from your text field). The second, ReturnPalletNo, returns a specified value from the list. You will need to devise a loop yourself in which to process the pallet numbers, but at least CountValues gives you the end value of your loop. It can be used to set the end value for a for-next or other kind of loop, as follows:
Expand|Select|Wrap|Line Numbers
  1. For I = 1 to CountValues(YourControlName)
The ReturnPalletNo function returns a Long value. It is called as follows:
Expand|Select|Wrap|Line Numbers
  1. LongVariable = ReturnPalletNo (WhichOne, ctlName)
where WhichOne is an integer value, 1 for the first value, 2 for the second and so on.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Public Function CountValues(EntryString As String) As Integer
  3.     Dim EntryCounter As Integer, EntryLength As Integer
  4.     Dim I As Integer, CharCount As Integer, ch As String
  5.     Const Separator = ";"
  6.     EntryLength = Len(EntryString)
  7.     For I = 1 To EntryLength
  8.         ch = Mid$(EntryString, I, 1)
  9.         If ch = Separator Then
  10.             If CharCount > 0 Then
  11.                 EntryCounter = EntryCounter + 1
  12.                 CharCount = 0
  13.             End If
  14.         Else
  15.             CharCount = CharCount + 1
  16.         End If
  17.     Next I
  18.     If CharCount > 0 Then
  19.         EntryCounter = EntryCounter + 1
  20.     End If
  21.     CountValues = EntryCounter
  22. End Function
  23.  
  24. Public Function ReturnPalletNo(EntryNumber As Integer, EntryString As String) As Long
  25.     'Returns the specified pallet number from the entry string, or
  26.     '0 if the EntryNumber is invalid
  27.     Dim EntryCounter As Integer, EntryLength As Integer
  28.     Dim I As Integer, CharCount As Integer, ch As String
  29.     Dim ResultString As String, ReturnValue As Long
  30.     Const Separator = ";"
  31.     If (EntryNumber <= 0) Or (EntryNumber > CountValues(EntryString)) Then
  32.         ReturnValue = 0
  33.     Else
  34.         EntryLength = Len(EntryString)
  35.         Do While (I < EntryLength) And (EntryCounter <> EntryNumber)
  36.             I = I + 1
  37.             ch = Mid$(EntryString, I, 1)
  38.             If ch = Separator Then
  39.                 If CharCount > 0 Then
  40.                     EntryCounter = EntryCounter + 1
  41.                     CharCount = 0
  42.                 End If
  43.             Else
  44.                 CharCount = CharCount + 1
  45.                 If CharCount = 1 Then
  46.                     ResultString = ch
  47.                 Else
  48.                     ResultString = ResultString & ch
  49.                 End If
  50.             End If
  51.         Loop
  52.     End If
  53.     If ResultString <> "" Then
  54.         ReturnValue = Val(ResultString)
  55.     End If
  56.     ReturnPalletNo = ReturnValue
  57. End Function
  58.  
In normal circumstances the use of Instr would have cut down the loop processing, but as you indicated in your post there are occasions when you have multiple separators ";;" within the text values, and as I could not guarantee that there would be a particular number of these I simply generalised the routines to function regardless of how many consecutive separators are present.

Sample output from immediate window of VBE:
Expand|Select|Wrap|Line Numbers
  1. ? ReturnPalletno(1, "20315;;20316")
  2.  20315
  3. ? ReturnPalletno(2, "20315;;20316")
  4.  20316 
  5. ? ReturnPalletno(3, "20315;;20316")
  6.  
Note that an invalid pallet number request will return a 0 result.

Hope this helps you complete a solution to extract the values from your text string.

-Stewart
Feb 26 '08 #2
missinglinq
3,532 Expert 2GB
Would this maybe work as a shortcut to CountValues?

Expand|Select|Wrap|Line Numbers
  1. PN = Me.PalletNo
  2.  If Not IsNull(PN) Then Pallets = Len(Replace(PN, ";;", ";")) - Len(Replace(Replace(PN, ";;", ";"), ";", "")) + 1
  3.  
What needs to be said here, of course, is that one of the Cardinal Rules of Relational Databases has been broken! That is, of course, the one-control/one-value rule. Multiple values should never be stored in a single control/field!

Linq ;0)>
Feb 27 '08 #3
billa856
101 100+
Thanks a lot buddy.I gurantee that it will help me.
Feb 27 '08 #4
billa856
101 100+
I modify ur code as per my requirement.its working but I only want to know in Acces is there any function like FLAG or Label.I don't know its name properly.
But in C or C++ we use this function to jump at perticular line in code.

this is just example code is not working.this is just sample to show what i want?.

1 x=some string
2 for(i=1,j=1;i<10,j<strlen(X);i++,j++)
3 {
4 if(i=j)
5 go to LabelA
6 else
7 some code
8 }
9 some code
10
.
.
.
20 LabelA:
21 for(k=0;k<10;k++)
22 {
23 print("string match");
24 }
How can I jump to line 5 to line 20?
Feb 27 '08 #5
NeoPa
32,556 Expert Mod 16PB
What you have there is the correct syntax for branching in VBA.
However, it's use is highly non-recommended. Procedural coding was supposed to do away with that construct generally. Procedural coding was the forerunner to OO coding. That's how long ago branching was considered (all but) redundant.

PS. I'd maybe consider using the Split() function to get the individual elements out of your [PalletNo] TextBox.
Feb 28 '08 #6
Scott Price
1,384 Expert 1GB
Open your VBA code editor window and type in GoTo. Position the cursor within the word and press F1. This brings up the help window associated with this command.

As NeoPa says, this is not a recommended programming procedure any more. It's only common usage in modern day VBA programming is in error handling code. However, it is provided, mostly for backward compatibility with existing code.

Regards,
Scott
Feb 28 '08 #7
NeoPa
32,556 Expert Mod 16PB
That's two errors in my post :(
The command is GoTo rather than Go To as Scott indicated.
Branching bacame old news when Procedural Programming was introduced. Procedural Programming was replaced by Structured Programming and THAT was superseeded by Object Oriented Programming.
Not highly recommended then :D
Feb 28 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: George Wei | last post by:
There are 2 pages Default.aspx and Result.aspx: <!-- Default.aspx --> <%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Default.master" CodeFile="Default.aspx.cs"...
4
by: Mori | last post by:
I am using masterPage and I need to populate a textbox that is in a content control with data from popup page that is not part of the master page. This code works if no masterpage is involved. ...
1
by: =?Utf-8?B?am9uZWZlcg==?= | last post by:
I keep getting the message after I converted a regular aspx page to now be based on a master page: "Only Content controls are allowed directly in a content page that contains Content controls."...
3
by: MikeB | last post by:
Hello, I have a content page that is from a Master page which has 2 content panes. How do I add my forms to the content page? Each pane needs a form but you can not have multiple form tags nor...
4
by: zacks | last post by:
I am developing a C#.NET application in VS2005 that needs a function that allows the user to edit some text content stored in a Text column in a database. I have a TextBox control with...
3
by: Bogdan | last post by:
Hi, I have a OnClientClick script assigned to a button. From the script, I'd like to check if RequiredFieldValidator attached to a textbox on the page has failed. The Page_IsValid works fine...
2
by: Ken Fine | last post by:
I want to add the security question and answer security feature to the ChangePassword control. I am aware that this functionality is built into the PasswordRecovery tool. I have implemented the...
2
by: pankajsingh5k | last post by:
Dear All, Please help me... I had read an article to lazy load a tab in a tabcontainer using an update panel on http://mattberseth.com/blog/2007/07/how_to_lazyload_tabpanels_with.html ...
2
by: greenMark | last post by:
Hi All, I'm relatively new to ASP.NET and Visual Web Developer 2008. I'm using a Master page with one content place holder. There is a Cascading Style Sheet file which is being refered by the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.