473,657 Members | 2,550 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

check content in textbox.

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

Now In First Form(ShippingAl erts)I have some fields like
AutoNo,BillToAd dress,ShipToAdd ress. and some other like
CustomerCode,It emNo,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(Co mboBox) 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(multip le 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(FinalPa lletNo).in that value is like this
24914;24913;249 12;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(ShippingEn try) person working on machine has to select AutoNo of First Form(ShippingAl erts).So it will automatically fill some fields from that form.like
BillToAddress,S hipToAddress And value TextBox(FianlPa lletNo) allocated to Another TextBox(PalletN o) 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(PalletN o).So person will know which PalletNo are remainng and which already done.I can do this thing if single value in TextBox(PalletN o).But there is value like this
24914;24913;249 12;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 2846
Stewart Ross
2,545 Recognized Expert Moderator Specialist
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 Recognized Expert Specialist
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 New Member
Thanks a lot buddy.I gurantee that it will help me.
Feb 27 '08 #4
billa856
101 New Member
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<1 0,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,568 Recognized Expert Moderator MVP
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 Recognized Expert Top Contributor
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,568 Recognized Expert Moderator MVP
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
1519
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" Inherits="_Default" %> <asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1"> &nbsp;<asp:Label ID="Label1" runat="server" Text="Please input a
4
3000
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. here is the javascript produced: <script>window.opener.document.forms.txtEndDate.value = '7/15/2006';self.close()</script> I basically need to populate txtEndDate on the content page. if
1
1734
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." What control, or line of Code is causing the error? here is the offending code :
3
2106
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 can the form tages be outside of the content tags? Does this make since? Below is my source to the pages. Basically I need both content tags to have form tags.
4
2075
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 AcceptsReturn, AcceptsTab and MultiLine properties all set to True. When I set the Text property of the control to the string returned from the database and show the form, the content in the textbox isn't "formatted". All newlines appear as a funky...
3
4972
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 with - for example - regex validator but it does not work with the required field validator. Any suggestions will be appreciated. Thanks, Bogdan
2
7657
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 PasswordRecovery with a Password reset required; a temporary password is sent to the account on file. I want an extra layer of security to accommodate the very unlikely contingency that someone's e-mail account is compromised. Challenging with the...
2
6940
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 and i am implementing it in my website....
2
9614
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 master page file as follws "<link href="myStyleSheet.css" rel="Stylesheet" type="text/css"/>" Part of the Style sheet as follows: .textbox
0
8425
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8326
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8845
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7355
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6177
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4333
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2745
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1736
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.