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.
7 2846
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: - For I = 1 to CountValues(YourControlName)
The ReturnPalletNo function returns a Long value. It is called as follows: - LongVariable = ReturnPalletNo (WhichOne, ctlName)
where WhichOne is an integer value, 1 for the first value, 2 for the second and so on. -
-
Public Function CountValues(EntryString As String) As Integer
-
Dim EntryCounter As Integer, EntryLength As Integer
-
Dim I As Integer, CharCount As Integer, ch As String
-
Const Separator = ";"
-
EntryLength = Len(EntryString)
-
For I = 1 To EntryLength
-
ch = Mid$(EntryString, I, 1)
-
If ch = Separator Then
-
If CharCount > 0 Then
-
EntryCounter = EntryCounter + 1
-
CharCount = 0
-
End If
-
Else
-
CharCount = CharCount + 1
-
End If
-
Next I
-
If CharCount > 0 Then
-
EntryCounter = EntryCounter + 1
-
End If
-
CountValues = EntryCounter
-
End Function
-
-
Public Function ReturnPalletNo(EntryNumber As Integer, EntryString As String) As Long
-
'Returns the specified pallet number from the entry string, or
-
'0 if the EntryNumber is invalid
-
Dim EntryCounter As Integer, EntryLength As Integer
-
Dim I As Integer, CharCount As Integer, ch As String
-
Dim ResultString As String, ReturnValue As Long
-
Const Separator = ";"
-
If (EntryNumber <= 0) Or (EntryNumber > CountValues(EntryString)) Then
-
ReturnValue = 0
-
Else
-
EntryLength = Len(EntryString)
-
Do While (I < EntryLength) And (EntryCounter <> EntryNumber)
-
I = I + 1
-
ch = Mid$(EntryString, I, 1)
-
If ch = Separator Then
-
If CharCount > 0 Then
-
EntryCounter = EntryCounter + 1
-
CharCount = 0
-
End If
-
Else
-
CharCount = CharCount + 1
-
If CharCount = 1 Then
-
ResultString = ch
-
Else
-
ResultString = ResultString & ch
-
End If
-
End If
-
Loop
-
End If
-
If ResultString <> "" Then
-
ReturnValue = Val(ResultString)
-
End If
-
ReturnPalletNo = ReturnValue
-
End Function
-
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: - ? ReturnPalletno(1, "20315;;20316")
-
20315
-
? ReturnPalletno(2, "20315;;20316")
-
20316
-
? ReturnPalletno(3, "20315;;20316")
-
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
Would this maybe work as a shortcut to CountValues? - PN = Me.PalletNo
-
If Not IsNull(PN) Then Pallets = Len(Replace(PN, ";;", ";")) - Len(Replace(Replace(PN, ";;", ";"), ";", "")) + 1
-
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)>
Thanks a lot buddy.I gurantee that it will help me.
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?
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.
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
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
Sign in to post your reply or Sign up for a free account.
Similar topics |
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">
<asp:Label ID="Label1" runat="server" Text="Please input a
|
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
|
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 :
|
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.
|
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...
| |
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
|
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...
|
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....
|
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
|
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...
|
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,...
| |
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |