Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Find Previous Entries In Text Box


You know guys how on internet explorer if you previously have entered a string in a text box it remembers every value that has been entered before in that text box and gives you the list. For instance if you are trying to login to a website you start typing your user name. Let's say my user name is hespinoza. If I type "h" then in the list will appear all entries begining with "h" If I type "e" then the list will filter its contents and only display values that start with "he" Does anyone has something that would help me figure this thing out?

Thanks a bunch.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Doing A Find Previous In Richtextbox?
is there any way to do this with a richtextbox? i did a find and i can do find next, but how do i make it do find previous?

Can't Find A Previous Post
There was a post a while back where someone wanted to find a running program if you only have a part of the programs caption. eg "Microsoft Word" or "Connecting to". I can't seem to find this anywhere. Can anyone find it?

Find Last Day Of Previous Month For A Date.
I have a date which the user enters on a form. I then want to find the last day of the month previous to it.


e.g. User Date 03/10/2003 Program Date 30/09/2003

dd/mm/yyyy


Is there an easy way to do this?

Find Last Day In Previous Month From A Date.
I have a date which the user enters on a form. I then want to find the last day of the month previous to it.


e.g. User Date 03/10/2003 Program Date 30/09/2003
dd/mm/yyyy dd/mm/yyyy


Is there an easy way to do this?

How To Find The Previous Saturday's Date
I know it is possible, but is there a quicker way and/or
trick to find the previous Saturday and/or a particular day?

Any advice would be greatly appreciated.

Jay

** RESOLVED ** How Do I Find The Previous Sundays Date ?
For example :

Today is Thursday.

I want to :

a) Work out the date for the Monday before last (i.e. not the one just gone, but the one before that.

b) Work out the date for the previous Sunday


These 2 dates will give me the date range for the previous week.

Obviously as the CURRENT week progresses both of these dates will move further into the past.

Is there a relatively neat way to calculate these dates ?

The only way i can think of is to use a SELECT CASE statement, based on the current day number, and subtract X amount according to the value returned.


Thanks in advance for any input on this one .......

How To Utilize Calendar Control To Find Out The Previous Day?
Hi,
I have a Calendar control and I needed previous day with date variable.
Somehow when I use the property it keeps telling me "mismatch..."

Debug.Print frmPPR.Calendar1.PreviousDay



Does anyone know the right way to get the previous date on it?



Thanks a lot!

How To Find All Duplicate Entries From A Field?
Dear Friends,

What is the code which get all the duplicate entries from a field in MS Access Database?

Say: I have one field "Details" in a table. And now I would like to check whether there are any duplicate data in it. What is the code for this?

Thanks in advance.

vblearner6

Sql Query - Find The Entries That Are Dropped By An Inner Join <Resolved>
I have an inner join statemtent that is dropping some of the records and I would like to see which records these are.

SELECT tblTime.JobID, tblTime.EmployeeID, tblTime.StandardHours, tblTime.OTHours
    FROM tblTime INNER JOIN
                           tblRates ON tbltime.EmployeeID = tblRates.EmployeeID
        WHERE tblTime.JobID = 2317
              GROUP BY tblTime.JobID, tblTime.EmployeeID, tblTime.StandardHours, tblTime.OTHours
                    ORDER BY tblTime.JobID

I get like 560 records with this statement, but about 610 with

select * from tblTime where JobID = 2317

Thanks in advance!



Edited by - Gresser on 4/22/2004 1:37:30 PM

Inserting My Own Text Into Rich Text Control Without Losing Previous Formats
Dears

I'd like to paste my own text into that control, but after attched code will be executed I'll get text in normal "text" style without changed fonts etc. How it needs to be done?

Dim Position As Long
Dim Buffer_Before As String
Dim Buffer_After As String

    Position = RichTextBox3.SelStart 'the place to insert desired text
    
    If RichTextBox3.SelLength > 1 Then
       RichTextBox3.SelLength = 1
    End If

    RichTextBox3.SelStart = 0
    RichTextBox3.SelLength = Position
    Buffer_Before = RichTextBox3.SelText 'first part of the text

    RichTextBox3.SelStart = Position
    RichTextBox3.SelLength = Len(RichTextBox3.Text) - Position
    Buffer_After = RichTextBox3.SelText 'second part
    RichTextBox3.TextRTF = Buffer_Before & "##Place##" & Buffer_After

Adding Text To Textbox Without Deleting Previous Text
Hello All

I'm new here. Been programming in VB 6.0 for a while but i'm a beginner.

I'm writing a sort of calculator that puts the results in a textbox. But when i get a new result i just want to add it to the textbox, but it erases the previous answer.
I can use a listbox (addItem) but I have to be able to copy the selection in the result field and i can't do that in a listbox.

In short.

Everytime i get a new result it has to edit the textfield, not clear it and start all over again.

TextBox1.Text = "result...."
That's the code i'm using to put in the result.

Anyone know a solution to this ?
Thanx in advance.

Add Text To .txt File Without Removing The Previous Text
Hi.

In my program I have this code that creates a text file and writes inside the text file everything that I wrote in textbox, each time i click the button:

Code:
Private Sub Command1_Click()
Open "d:hello.txt" For Output Lock Read As #1
Print #1, Text1.Text
Close #1
End Sub


The problem is:
Each time I click the button, it replaces the previous text file in a new one (what makes the information of the previous one dissappear).

How can I write the text1.text in that file without removing the previous?

Lets say I type "Hello" and it saves me as a text file. Next time I type "my friend", it will save it too and in the text file will be "Hello my friend" without deleting "Hello".

Recording Previous Text
Hi guys,
If I have 3 types of values to display in a text box, and i wan them to record the previous results, how can i do it without the textbox repeating the answer? for eg.
if check1 = 1 then
text4.text = .......(the formula) & vbNewLine & _
text4.text
if check2 = 1 then
text4.text = .......(the formula) & vbNewLine & _
text4.text
if check3 = 1 then
text4.text = .......(the formula) & vbNewLine & _
text4.text
When i do this, it always record a result more than once. The result will turn out like this. For eg, first time round
Answer1
Next time I calculate again, I only wan it to display the latest answer, yet it displays
Answer2
Answer1
Answer1
can i make it such that everytime i click the commandbutton, it will only display the latest answer and the previous answer. thank you.

Set Text To Previous Path
I am using CommonDialog1 to browse for a folder. I also have a text field that I want to have set to the last path and file opened.

I am pretty new to VB and here is what I am using.
This will set the text AFTER I double click a file, but I want to have the previous path already in the text field.


Code:
Private Sub Command1_Click()
CommonDialog1.ShowOpen
Form1.Text1.Text = CommonDialog1.FileName
End Sub

Private Sub Form_Load()

Form1.Text1.Text = CommonDialog1.FileName '<-- this dosent work

End Sub

Text Entries
This is what i have so far

Code:
Open "edittext.txt" For Output As #1
Open "originaltext.txt" For Input As #2

x = 1
Do While Not EOF(1)
Input #2, UserName, UserID
If Not NewUser.User.Selected(nIndex) = UserName Then
Write #1, UserName, UserID
End If
x = x + 1
Loop
Close #1
Close #2
It doesn't write anything to text.txt , can anyone tell me what is going on??

Also, how do i rename edittext.txt to originaltext.txt. I think i have to kill originaltext.txt first.

Text Box Entries
I have put several Text Box's on a Form and assigned this as Text in the Text Box's property sheet "[- Available -]". When I try to Type something in th TextBox it won't do it nothing Happens. Do I have to erase what's in the Box and Then Type or What?

Cannot Append Text To Previous File
I'm able to create the file but everytime I try to append text to it, it erases the first line. Here is the code


Code:
Dim fso, TStream
Dim FileName As String
Dim FileMessage As String

Set fso = CreateObject("Scripting.FileSystemObject")
FileName = "Log File.txt"
Set TStream = fso.OpenTextFile("C:" & FileName, 2, True)
FileMessage = "Test"

Call TStream.WriteLine(FileMessage)

Any ideas?

Clearing Previous Graphic Text
I'm using the following to write text to a picture box. When I
move the text the Prev Text stays visibile at the old location.
Can't refresh the PBox without the text do to timing of other code.

Using Static variable to write blank string at old location won't work since this routine is called by several different routines which write text at different spots in the PBox.

Thought of using a Static array to hold all old values, but looking
for a better solution -- if possible.


VB Code:
With objPicBox     'Move CurrentX Labels    .CurrentX =  XValue    .CurrentY = YValueEnd WithobjPicBox.Print strNumber


SUGGESTIONS?

Bringing Up Previous Text In A Text Box
Hi,

There are various command buttons on my form. When clicked, they load text into a textbox.

For example,

Command1_click()
Text1.text="Welcome to part one"
end sub

So there are a lot of buttons like this that can be clicked in any order.

I want a different button, a 'Back' button, that when clicked will make the text that was previously in the textbox, before they clicked the command button, appear.

Does anybody know how I could do this?

Thanks.

Saving Text Box Entries
Is there a way to save the entry in a text box so that the next time the user form is entered the text that was entered the last time appears in the text box?

For example, when my VBA user form pops up I ask for the company name and their website which they enter into a text box. Is there a way for that information to be there when they open the word document in the future?

Thanks.

Mike

Multiple Entries In 1 Text Box
I need help doing something with a text box. Heres the situation... I have a command that brings a text box visible to the form. I then want the user to input say "5" into the text box... and then hit a command that says add which takes that number to a label called total... then if the user has another number to put into the text box, the first one entry deletes after the add command is pushed and the user can put another entry in the same text box. Say the number is "4", then the add command is pushed again deleting the "4" and adding it to the 5 previously in the label. Can somebody help me with pseudo code?

Textbox Entries To Show Latest Appended Entries.
How do set a textbox to show the latest appended entry? When data is appended to a text box it always resets to the top of the window. To view the appended data one must scroll down. I would like to keep the latest viewable. Any ideas, please?

[help] Select All Previous Text To Last Header Style 3
My mum is a secretary and when writing reports (in Word 2003) for her (nasty) boss she has to wrap certain paragraphs in a rectangle with curved corners. This takes her quite a while to accomplish as the colour must be a certian type, width and, well, it just gets on her nerves!

Every paragraph begins with a header formated using 'header style 3'
I tried recording a macro to do this for her but can only get it to select an exact amount of lines.

My question is: what is the code to select all the previous text upto and including the last header style 3?

I've included all the code from my recorded macro and hope it helps!

Many thanks for looking + I hope i've put this in the correct forum & format.


Code:
Sub disco2()
'
' disco2 Macro
' Macro recorded 8/28/2007 by Martin
'
Selection.TypeParagraph
Selection.TypeParagraph
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.MoveUp Unit:=wdParagraph, Count:=5, Extend:=wdExtend
Selection.Cut
ActiveDocument.Shapes.AddShape(msoShapeRoundedRectangle, 90#, 72#, _
432#, 27#).Select
Selection.ShapeRange.Fill.Visible = msoTrue
Selection.ShapeRange.Fill.Solid
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 255, 255)
Selection.ShapeRange.Fill.Transparency = 0#
Selection.ShapeRange.Line.Weight = 2#
Selection.ShapeRange.Line.DashStyle = msoLineSolid
Selection.ShapeRange.Line.Style = msoLineSingle
Selection.ShapeRange.Line.Transparency = 0#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.ForeColor.RGB = RGB(204, 153, 255)
Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
Selection.ShapeRange.LockAspectRatio = msoFalse
Selection.ShapeRange.Rotation = 0#
Selection.ShapeRange.Left = 90.1
Selection.ShapeRange.Top = 72#
Selection.ShapeRange.RelativeHorizontalPosition = _
wdRelativeHorizontalPositionColumn
Selection.ShapeRange.RelativeVerticalPosition = _
wdRelativeVerticalPositionParagraph
Selection.ShapeRange.Left = wdShapeLeft
Selection.ShapeRange.Top = CentimetersToPoints(0)
Selection.ShapeRange.LockAnchor = True
Selection.ShapeRange.LayoutInCell = True
Selection.ShapeRange.WrapFormat.AllowOverlap = False
Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
Selection.ShapeRange.WrapFormat.DistanceTop = CentimetersToPoints(0)
Selection.ShapeRange.WrapFormat.DistanceBottom = CentimetersToPoints(0)
Selection.ShapeRange.WrapFormat.DistanceLeft = CentimetersToPoints(0.32)
Selection.ShapeRange.WrapFormat.DistanceRight = CentimetersToPoints(0.32)
Selection.ShapeRange.WrapFormat.Type = wdWrapTopBottom
Selection.ShapeRange.TextFrame.TextRange.Select
Selection.Collapse
Selection.ShapeRange.Select
Selection.ShapeRange.Fill.Visible = msoTrue
Selection.ShapeRange.Fill.Solid
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 255, 255)
Selection.ShapeRange.Fill.Transparency = 0#
Selection.ShapeRange.Line.Weight = 2#
Selection.ShapeRange.Line.DashStyle = msoLineSolid
Selection.ShapeRange.Line.Style = msoLineSingle
Selection.ShapeRange.Line.Transparency = 0#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.ForeColor.RGB = RGB(204, 153, 255)
Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
Selection.ShapeRange.LockAspectRatio = msoFalse
Selection.ShapeRange.Rotation = 0#
Selection.ShapeRange.Left = 91.55
Selection.ShapeRange.Top = 73.4
Selection.ShapeRange.TextFrame.MarginLeft = 7.09
Selection.ShapeRange.TextFrame.MarginRight = 7.09
Selection.ShapeRange.TextFrame.MarginTop = 3.69
Selection.ShapeRange.TextFrame.MarginBottom = 3.69
Selection.PasteAndFormat (wdPasteDefault)
Selection.ShapeRange.RelativeHorizontalPosition = _
wdRelativeHorizontalPositionColumn
Selection.ShapeRange.RelativeVerticalPosition = _
wdRelativeVerticalPositionParagraph
Selection.ShapeRange.Left = wdShapeLeft
Selection.ShapeRange.Top = CentimetersToPoints(0)
Selection.ShapeRange.LockAnchor = True
Selection.ShapeRange.LayoutInCell = True
Selection.ShapeRange.WrapFormat.AllowOverlap = False
Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
Selection.ShapeRange.WrapFormat.DistanceTop = CentimetersToPoints(0)
Selection.ShapeRange.WrapFormat.DistanceBottom = CentimetersToPoints(0)
Selection.ShapeRange.WrapFormat.DistanceLeft = CentimetersToPoints(0.32)
Selection.ShapeRange.WrapFormat.DistanceRight = CentimetersToPoints(0.32)
Selection.ShapeRange.WrapFormat.Type = wdWrapTopBottom
Selection.ShapeRange.TextFrame.AutoSize = True
Selection.ShapeRange.TextFrame.WordWrap = False
Selection.ShapeRange.TextFrame.TextRange.Select
Selection.Collapse
Selection.ShapeRange.Select
Selection.ShapeRange.Fill.Visible = msoTrue
Selection.ShapeRange.Fill.Solid
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 255, 255)
Selection.ShapeRange.Fill.Transparency = 0#
Selection.ShapeRange.Line.Weight = 2#
Selection.ShapeRange.Line.DashStyle = msoLineSolid
Selection.ShapeRange.Line.Style = msoLineSingle
Selection.ShapeRange.Line.Transparency = 0#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.ForeColor.RGB = RGB(204, 153, 255)
Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
Selection.ShapeRange.LockAspectRatio = msoFalse
Selection.ShapeRange.Rotation = 0#
Selection.ShapeRange.Left = 91.55
Selection.ShapeRange.Top = 73.4
Selection.ShapeRange.TextFrame.MarginLeft = 7.09
Selection.ShapeRange.TextFrame.MarginRight = 7.09
Selection.ShapeRange.TextFrame.MarginTop = 3.69
Selection.ShapeRange.TextFrame.MarginBottom = 3.69
Selection.ShapeRange.RelativeHorizontalPosition = _
wdRelativeHorizontalPositionColumn
Selection.ShapeRange.RelativeVerticalPosition = _
wdRelativeVerticalPositionParagraph
Selection.ShapeRange.Left = wdShapeLeft
Selection.ShapeRange.Top = CentimetersToPoints(0)
Selection.ShapeRange.LockAnchor = True
Selection.ShapeRange.LayoutInCell = True
Selection.ShapeRange.WrapFormat.AllowOverlap = False
Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
Selection.ShapeRange.WrapFormat.DistanceTop = CentimetersToPoints(0)
Selection.ShapeRange.WrapFormat.DistanceBottom = CentimetersToPoints(0)
Selection.ShapeRange.WrapFormat.DistanceLeft = CentimetersToPoints(0.32)
Selection.ShapeRange.WrapFormat.DistanceRight = CentimetersToPoints(0.32)
Selection.ShapeRange.WrapFormat.Type = wdWrapTopBottom
Selection.ShapeRange.TextFrame.AutoSize = True
Selection.ShapeRange.TextFrame.WordWrap = True
Selection.ShapeRange(1).ConvertToFrame
End Sub

Saving Text Entries In UserForms
I am using VBA in Reflection, a terminal emulator software. I am building a UserForm to replace a series of input boxes that the user is currently being prompted for. The input boxes have code to save the last entry in the box so that the user does not have to re-enter the same data every time. Is there a way to use code for each text box in a UserForm to store the last entered data, until the user changes it?

Thanks

Grab Text Entries From A Dropdown
How can I grab all the choices in a combobox?

To Check For Blank Entries In A Text Box
Hi friends

First of all let me introduce myself, I am Peters A P. I just started learning VB.

I have a question regarding the following

I have a form, where I want to enter alphanumeric values in the text box and then it should update to the database.

The form has around 25 text boxes, out of which I need to enter complusorily for 10 textboxes. How do I check that and give an error message if I forget to enter one value in one textbox.

I am pasting part of codes below, here I am checking for text1.box whether it is blank, similarly, i need to check for 9 more text boxes. How do I do that


Private Sub cmdSave_Click()
Dim contactrec As New ADODB.Recordset
contactcon.Open "smmdetails"
Set contactrec = contactcon.Execute("Select * from smm_details")
If contactrec.BOF = True Then
If txtBox1.Text = "" Then
MsgBox "Please enter Name of the Firm"
Else
contactcon.Execute ("insert into smm_details(name_of_company, type_of_business, ho_address, ho_city, ho_country, " & _
"ho_tel_no_1, ho_tel_no_2, ho_fax_no_1, ho_fax_no_2, ho_email_1, ho_email_2, ho_website, ho_contact_person, ho_contact_person_mobile, " & _
"local_address, local_city, local_country, local_tel_no_1, local_tel_no_2, local_fax -no, local_email, local_contact_person, local_contact_person_mobile, " & _
"sponsor_name, sponsor_tel_no_1, sponsor_tel_no_2, sponsor_fax_no_1, sponsor_mobile_no, sponsor_email, owner_name, owner_tel_no_1, owner_mobile_no, " & _
"owner_passport, owner_nationality, owner_passport_expiry) Values('" & txtBox1.Text & "')")
End If
Else
MsgBox "Record Already Exists"
End If
contactrec.Close
End Sub

Reverse Entries In A Text File
Hi all..
I have a program I wrote that outputs abnormal program activity to a text file.
Example: Say user tries to choose a non-existant path:
message= "Path error encountered."
Goes to a sub called logme:
sub logme
open "errorlog.txt" for append as #1
print #1, message
close 1

Pretty simple I know.
But what if I wanted to limit the errorlog.txt file size to 100 entries?
Is there a simple way to delete entry #1 when entry #101 is made?

Currently program counts the number of lines in the file before writing to it. If over 100 then it copies everything except entry #1 to another file (erorlog.tmp). It then adds entry 101 to errorlog.tmp.
It then deletes errorlog.txt, renames errorlog.tmp to errorlog.txt. This results in 100 entries, first in-first out.
There has got to be a cleaner way to do this, and I know you are the guys to ask.
Thanks.

Writing To Text File W/out Re-wrtiing Over Previous Data
I have this program that makes a log of input text from the user..

But I would like so that when the user saves the log, it does not overwrite previous logs from previous saves..

Anyone wanna help me out?

I just use the Open for Output functions.

How To Add Formatted Text To Richtextbox While Preserving Previous Formats
Here's the code everyone was looking for :

Code:
With Richtextbox
   'Go to the end of the Richtextbox
   .SelStart = Len(.Text)
   'Insert new line and your text
   .SelText = vbCrLf & YOURTEXT
   'Select only your text for formating
   .SelStart = Len(.Text) - Len(YOURTEXT)
   .SelLength = Len(ChatFrom) + 2
   'Format your text
   .SelColor = vbRed
   .SelBold = True
   'Etc...
End With


Hope this helps everyone!

Removing Duplicate Entries In A Text File
I have an email list that has an email address on each line. The problem is that some emails appear more than once in the file.

I'd like to parse out the dups and create a file of non-dups and a file of all the dups

here' the code I have and it sure isn't working. Maybe my brain isn't working right today


Code:
set objFS=CreateObject ("Scripting.FileSystemObject")
set listFile = objFS.OpenTextFile ("BADEMAILS.txt")
set listFile1 = objFS.OpenTextFile ("BADEMAILS1.txt")

set logfile = objFS.CreateTextFile("Final-Removed.txt")
set logfile1 = objFS.CreateTextFile("Final-Removed-dups.txt")

count = 1
do while listFile.AtEndOfStream <> True
line1 = listFile.ReadLine

count1 = 1
listFile1.open
do while listFile1.AtEndOfStream <> True
line2 = listFile1.ReadLine

if line1 <> line2 then
logfile.writeline line2
else
logfile1.writeline line2
end if

count1 = count1 + 1
Loop

listFile1.close

count = count + 1
Loop

BADEMAILS.txt and BADEMAILS1.txt are identical. The only way I could think is to open one file and walk down each line while looping through a different file with the same content parsing out the dups?

Any help would be appreciated

Thanks

Deleting Double Entries In Text Files. How To?
hello,

I have a text file with the following information:
name, address, phone number
I want to use vb to delete entries with the same name, so I would
have only the latest updated information about that name.
how can I do this with vb?

thanks

Remove Duplicate Entries From Text File....
hi, say i have a textbox with numbers like this:


345
645
878
8978
585
64
3
56


how would i make a program which removes duplicate entries from the textbox? i've more or less got a similar bit of code working which works for a listbox, but i'm kinda stuck with how to do it on a textbox. can anyone help?

[solved] Sorting Entries In Text Files
foe example i have a text file named mydbs.txt

the entries inside it are
anything 12.00
others 65.65
helpme 56.76
anyone 96.65
schizo 44.44

how do i get the entries to be sorted where the highest entry is on the top of the file...

Print Text Box Entries To Seperate .txt File
I am very new to VB and am currently trying to work out how to copy each answer from a text box into a .txt file. For instance name and address details. Can anyone help ?

Thanx in advance,

Putting Text File Entries Into An Array
Hey all!

OK, what I want to do is put a whole bunch of names into an array from a text file. The names are already in correct order, all I want to do is get entry #1 into label #1, entry #2 into label #2 etc. How do I do this?

This is what I've got, but I know it doesn't work.


Code:
Private Sub Form_Load()
Dim Name as String, i as String

Open "c:lennycollingwoodfilesPlayers.txt" For Output As #1
For i = 1 To 52
Input #1, Name
lblPlayer(i).Caption = Name
Name = ""
Next i

End Sub



Thanks in advance for any help you can offer.

How To Limit Text Box Character Entries To NUMBERS Only??
How can I make is so that a user can only enter numbers in text boxes?

Thanks

Multiple Text Box Entries On Form To Array
Can anyone help. I have multiple text boxes on a form, and I want the code to go through each text box and put the text in to a 2D array.

The text boxes are created after the user input the number of verticies, 2 verticies creates 4 text boxes done with this code

Private Sub Form_Load()
Dim ctlName As Control
Dim TBox_name As String
Dim Tbox_value As String
Dim i As Integer
Dim Top As Integer
i = 0
Top = 500
TBox_name = "Text"
For i = 0 To Verticies - 1
    Tbox_value = CSng(i + 1)
    TBox_name = TBox_name + Tbox_value
    Set ctlName = Form4.Controls.Add("VB.TextBox", TBox_name, Form4)
    ctlName.Visible = True
    ctlName.Top = Top * (i + 1)
    ctlName.Left = 500
    ctlName.Width = 700
    ctlName.Height = 200
    Tbox_value = CSng(i + 2)
    TBox_name = TBox_name + Tbox_value
    Set ctlName = Form4.Controls.Add("VB.TextBox", TBox_name, Form4)
    ctlName.Visible = True
    ctlName.Top = Top * (i + 1)
    ctlName.Left = 1700
    ctlName.Width = 700
    ctlName.Height = 200
Next
Form4.Height = (Top * (i + 1)) + 500
End Sub

Thanks for your help.

Iain

Deleting Duplicate Entries In A Text File
okay here is my code...i can load the file and add to it and close it and i know how to check for duplicate items, but how can i delete the duplicate entry....

private Sub Form_Load()
Dim Temp as string
lstClient.Clear ' clear current entries
Open "C:
ame.txt" for input as #1
Do Until EOF(1)
Line input #1, Temp
lstClient.AddItem Temp
Loop
Close #1
lblDisplay.Caption = lstClient.ListCount
End Sub

private Sub cmdClose_Click()
Dim X
Open "C:
ame.txt" for Output as #1
for X = 0 to lstClient.ListCount - 1
print #1, lstClient.List(X)
next X
Close #1
Unload me
End Sub




thanx in advance

midnight service

How Do I Write Data Into A Text File Continue After The Previous Section?
hi, lets say i already have a "c:Data.txt"
in the text file already contain some text and paragraph:

for example:
Jim:"Hi, Paul. How are you?"
Paul:"I'm fine, just a bit boring..."

and so i wish the add in the next line:
Jim:"Why don't you go out and play?"

so, how do i detect that it's the end of the file and i add it in the next line?

(Help) Select All Previous Text To Last Header Style 3 Using Word 2003
My mum is a secretary and when writing reports (in Word 2003) for her (nasty) boss she has to wrap certain paragraphs in a rectangle with curved corners.  This takes her quite a while to accomplish as the colour must be a certian type, width and, well, it just gets on her nerves!

Every paragraph begins with a header formated using 'header style 3'
I tried recording a macro to do this for her but can only get it to select an exact amount of lines.

My question is: what is the code to select all the previous text upto and including the last header style 3?

I've included all the code from my recorded macro and hope it helps!

Many thanks for looking + I hope i've put this in the correct forum & format.

CODESub disco2()
'
' disco2 Macro
' Macro recorded 8/28/2007 by Martin
'
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.MoveUp Unit:=wdLine, Count:=1
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
    Selection.MoveUp Unit:=wdParagraph, Count:=5, Extend:=wdExtend
    Selection.Cut
    ActiveDocument.Shapes.AddShape(msoShapeRoundedRectangle, 90#, 72#, _
        432#, 27#).Select
    Selection.ShapeRange.Fill.Visible = msoTrue
    Selection.ShapeRange.Fill.Solid
    Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 255, 255)
    Selection.ShapeRange.Fill.Transparency = 0#
    Selection.ShapeRange.Line.Weight = 2#
    Selection.ShapeRange.Line.DashStyle = msoLineSolid
    Selection.ShapeRange.Line.Style = msoLineSingle
    Selection.ShapeRange.Line.Transparency = 0#
    Selection.ShapeRange.Line.Visible = msoTrue
    Selection.ShapeRange.Line.ForeColor.RGB = RGB(204, 153, 255)
    Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
    Selection.ShapeRange.LockAspectRatio = msoFalse
    Selection.ShapeRange.Rotation = 0#
    Selection.ShapeRange.Left = 90.1
    Selection.ShapeRange.Top = 72#
    Selection.ShapeRange.RelativeHorizontalPosition = _
        wdRelativeHorizontalPositionColumn
    Selection.ShapeRange.RelativeVerticalPosition = _
        wdRelativeVerticalPositionParagraph
    Selection.ShapeRange.Left = wdShapeLeft
    Selection.ShapeRange.Top = CentimetersToPoints(0)
    Selection.ShapeRange.LockAnchor = True
    Selection.ShapeRange.LayoutInCell = True
    Selection.ShapeRange.WrapFormat.AllowOverlap = False
    Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
    Selection.ShapeRange.WrapFormat.DistanceTop = CentimetersToPoints(0)
    Selection.ShapeRange.WrapFormat.DistanceBottom = CentimetersToPoints(0)
    Selection.ShapeRange.WrapFormat.DistanceLeft = CentimetersToPoints(0.32)
    Selection.ShapeRange.WrapFormat.DistanceRight = CentimetersToPoints(0.32)
    Selection.ShapeRange.WrapFormat.Type = wdWrapTopBottom
    Selection.ShapeRange.TextFrame.TextRange.Select
    Selection.Collapse
    Selection.ShapeRange.Select
    Selection.ShapeRange.Fill.Visible = msoTrue
    Selection.ShapeRange.Fill.Solid
    Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 255, 255)
    Selection.ShapeRange.Fill.Transparency = 0#
    Selection.ShapeRange.Line.Weight = 2#
    Selection.ShapeRange.Line.DashStyle = msoLineSolid
    Selection.ShapeRange.Line.Style = msoLineSingle
    Selection.ShapeRange.Line.Transparency = 0#
    Selection.ShapeRange.Line.Visible = msoTrue
    Selection.ShapeRange.Line.ForeColor.RGB = RGB(204, 153, 255)
    Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
    Selection.ShapeRange.LockAspectRatio = msoFalse
    Selection.ShapeRange.Rotation = 0#
    Selection.ShapeRange.Left = 91.55
    Selection.ShapeRange.Top = 73.4
    Selection.ShapeRange.TextFrame.MarginLeft = 7.09
    Selection.ShapeRange.TextFrame.MarginRight = 7.09
    Selection.ShapeRange.TextFrame.MarginTop = 3.69
    Selection.ShapeRange.TextFrame.MarginBottom = 3.69
    Selection.PasteAndFormat (wdPasteDefault)
    Selection.ShapeRange.RelativeHorizontalPosition = _
        wdRelativeHorizontalPositionColumn
    Selection.ShapeRange.RelativeVerticalPosition = _
        wdRelativeVerticalPositionParagraph
    Selection.ShapeRange.Left = wdShapeLeft
    Selection.ShapeRange.Top = CentimetersToPoints(0)
    Selection.ShapeRange.LockAnchor = True
    Selection.ShapeRange.LayoutInCell = True
    Selection.ShapeRange.WrapFormat.AllowOverlap = False
    Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
    Selection.ShapeRange.WrapFormat.DistanceTop = CentimetersToPoints(0)
    Selection.ShapeRange.WrapFormat.DistanceBottom = CentimetersToPoints(0)
    Selection.ShapeRange.WrapFormat.DistanceLeft = CentimetersToPoints(0.32)
    Selection.ShapeRange.WrapFormat.DistanceRight = CentimetersToPoints(0.32)
    Selection.ShapeRange.WrapFormat.Type = wdWrapTopBottom
    Selection.ShapeRange.TextFrame.AutoSize = True
    Selection.ShapeRange.TextFrame.WordWrap = False
    Selection.ShapeRange.TextFrame.TextRange.Select
    Selection.Collapse
    Selection.ShapeRange.Select
    Selection.ShapeRange.Fill.Visible = msoTrue
    Selection.ShapeRange.Fill.Solid
    Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 255, 255)
    Selection.ShapeRange.Fill.Transparency = 0#
    Selection.ShapeRange.Line.Weight = 2#
    Selection.ShapeRange.Line.DashStyle = msoLineSolid
    Selection.ShapeRange.Line.Style = msoLineSingle
    Selection.ShapeRange.Line.Transparency = 0#
    Selection.ShapeRange.Line.Visible = msoTrue
    Selection.ShapeRange.Line.ForeColor.RGB = RGB(204, 153, 255)
    Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
    Selection.ShapeRange.LockAspectRatio = msoFalse
    Selection.ShapeRange.Rotation = 0#
    Selection.ShapeRange.Left = 91.55
    Selection.ShapeRange.Top = 73.4
    Selection.ShapeRange.TextFrame.MarginLeft = 7.09
    Selection.ShapeRange.TextFrame.MarginRight = 7.09
    Selection.ShapeRange.TextFrame.MarginTop = 3.69
    Selection.ShapeRange.TextFrame.MarginBottom = 3.69
    Selection.ShapeRange.RelativeHorizontalPosition = _
        wdRelativeHorizontalPositionColumn
    Selection.ShapeRange.RelativeVerticalPosition = _
        wdRelativeVerticalPositionParagraph
    Selection.ShapeRange.Left = wdShapeLeft
    Selection.ShapeRange.Top = CentimetersToPoints(0)
    Selection.ShapeRange.LockAnchor = True
    Selection.ShapeRange.LayoutInCell = True
    Selection.ShapeRange.WrapFormat.AllowOverlap = False
    Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
    Selection.ShapeRange.WrapFormat.DistanceTop = CentimetersToPoints(0)
    Selection.ShapeRange.WrapFormat.DistanceBottom = CentimetersToPoints(0)
    Selection.ShapeRange.WrapFormat.DistanceLeft = CentimetersToPoints(0.32)
    Selection.ShapeRange.WrapFormat.DistanceRight = CentimetersToPoints(0.32)
    Selection.ShapeRange.WrapFormat.Type = wdWrapTopBottom
    Selection.ShapeRange.TextFrame.AutoSize = True
    Selection.ShapeRange.TextFrame.WordWrap = True
    Selection.ShapeRange(1).ConvertToFrame
End Sub

(Help) Select All Previous Text To Last Header Style 3 Using Word 2003
My mum is a secretary and when writing reports (in Word 2003) for her (nasty) boss she has to wrap certain paragraphs in a rectangle with curved corners. This takes her quite a while to accomplish as the colour must be a certian type, width and, well, it just gets on her nerves!

Every paragraph begins with a header formated using 'header style 3'
I tried recording a macro to do this for her but can only get it to select an exact amount of lines.

My question is: what is the code to select all the previous text upto and including the last header style 3?

I've included all the code from my recorded macro and hope it helps!

Many thanks for looking + I hope i've put this in the correct forum & format.

Code:
Sub disco2()
'
' disco2 Macro
' Macro recorded 8/28/2007 by Martin
'
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.MoveUp Unit:=wdLine, Count:=1
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
    Selection.MoveUp Unit:=wdParagraph, Count:=5, Extend:=wdExtend
    Selection.Cut
    ActiveDocument.Shapes.AddShape(msoShapeRoundedRectangle, 90#, 72#, _
        432#, 27#).Select
    Selection.ShapeRange.Fill.Visible = msoTrue
    Selection.ShapeRange.Fill.Solid
    Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 255, 255)
    Selection.ShapeRange.Fill.Transparency = 0#
    Selection.ShapeRange.Line.Weight = 2#
    Selection.ShapeRange.Line.DashStyle = msoLineSolid
    Selection.ShapeRange.Line.Style = msoLineSingle
    Selection.ShapeRange.Line.Transparency = 0#
    Selection.ShapeRange.Line.Visible = msoTrue
    Selection.ShapeRange.Line.ForeColor.RGB = RGB(204, 153, 255)
    Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
    Selection.ShapeRange.LockAspectRatio = msoFalse
    Selection.ShapeRange.Rotation = 0#
    Selection.ShapeRange.Left = 90.1
    Selection.ShapeRange.Top = 72#
    Selection.ShapeRange.RelativeHorizontalPosition = _
        wdRelativeHorizontalPositionColumn
    Selection.ShapeRange.RelativeVerticalPosition = _
        wdRelativeVerticalPositionParagraph
    Selection.ShapeRange.Left = wdShapeLeft
    Selection.ShapeRange.Top = CentimetersToPoints(0)
    Selection.ShapeRange.LockAnchor = True
    Selection.ShapeRange.LayoutInCell = True
    Selection.ShapeRange.WrapFormat.AllowOverlap = False
    Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
    Selection.ShapeRange.WrapFormat.DistanceTop = CentimetersToPoints(0)
    Selection.ShapeRange.WrapFormat.DistanceBottom = CentimetersToPoints(0)
    Selection.ShapeRange.WrapFormat.DistanceLeft = CentimetersToPoints(0.32)
    Selection.ShapeRange.WrapFormat.DistanceRight = CentimetersToPoints(0.32)
    Selection.ShapeRange.WrapFormat.Type = wdWrapTopBottom
    Selection.ShapeRange.TextFrame.TextRange.Select
    Selection.Collapse
    Selection.ShapeRange.Select
    Selection.ShapeRange.Fill.Visible = msoTrue
    Selection.ShapeRange.Fill.Solid
    Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 255, 255)
    Selection.ShapeRange.Fill.Transparency = 0#
    Selection.ShapeRange.Line.Weight = 2#
    Selection.ShapeRange.Line.DashStyle = msoLineSolid
    Selection.ShapeRange.Line.Style = msoLineSingle
    Selection.ShapeRange.Line.Transparency = 0#
    Selection.ShapeRange.Line.Visible = msoTrue
    Selection.ShapeRange.Line.ForeColor.RGB = RGB(204, 153, 255)
    Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
    Selection.ShapeRange.LockAspectRatio = msoFalse
    Selection.ShapeRange.Rotation = 0#
    Selection.ShapeRange.Left = 91.55
    Selection.ShapeRange.Top = 73.4
    Selection.ShapeRange.TextFrame.MarginLeft = 7.09
    Selection.ShapeRange.TextFrame.MarginRight = 7.09
    Selection.ShapeRange.TextFrame.MarginTop = 3.69
    Selection.ShapeRange.TextFrame.MarginBottom = 3.69
    Selection.PasteAndFormat (wdPasteDefault)
    Selection.ShapeRange.RelativeHorizontalPosition = _
        wdRelativeHorizontalPositionColumn
    Selection.ShapeRange.RelativeVerticalPosition = _
        wdRelativeVerticalPositionParagraph
    Selection.ShapeRange.Left = wdShapeLeft
    Selection.ShapeRange.Top = CentimetersToPoints(0)
    Selection.ShapeRange.LockAnchor = True
    Selection.ShapeRange.LayoutInCell = True
    Selection.ShapeRange.WrapFormat.AllowOverlap = False
    Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
    Selection.ShapeRange.WrapFormat.DistanceTop = CentimetersToPoints(0)
    Selection.ShapeRange.WrapFormat.DistanceBottom = CentimetersToPoints(0)
    Selection.ShapeRange.WrapFormat.DistanceLeft = CentimetersToPoints(0.32)
    Selection.ShapeRange.WrapFormat.DistanceRight = CentimetersToPoints(0.32)
    Selection.ShapeRange.WrapFormat.Type = wdWrapTopBottom
    Selection.ShapeRange.TextFrame.AutoSize = True
    Selection.ShapeRange.TextFrame.WordWrap = False
    Selection.ShapeRange.TextFrame.TextRange.Select
    Selection.Collapse
    Selection.ShapeRange.Select
    Selection.ShapeRange.Fill.Visible = msoTrue
    Selection.ShapeRange.Fill.Solid
    Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 255, 255)
    Selection.ShapeRange.Fill.Transparency = 0#
    Selection.ShapeRange.Line.Weight = 2#
    Selection.ShapeRange.Line.DashStyle = msoLineSolid
    Selection.ShapeRange.Line.Style = msoLineSingle
    Selection.ShapeRange.Line.Transparency = 0#
    Selection.ShapeRange.Line.Visible = msoTrue
    Selection.ShapeRange.Line.ForeColor.RGB = RGB(204, 153, 255)
    Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
    Selection.ShapeRange.LockAspectRatio = msoFalse
    Selection.ShapeRange.Rotation = 0#
    Selection.ShapeRange.Left = 91.55
    Selection.ShapeRange.Top = 73.4
    Selection.ShapeRange.TextFrame.MarginLeft = 7.09
    Selection.ShapeRange.TextFrame.MarginRight = 7.09
    Selection.ShapeRange.TextFrame.MarginTop = 3.69
    Selection.ShapeRange.TextFrame.MarginBottom = 3.69
    Selection.ShapeRange.RelativeHorizontalPosition = _
        wdRelativeHorizontalPositionColumn
    Selection.ShapeRange.RelativeVerticalPosition = _
        wdRelativeVerticalPositionParagraph
    Selection.ShapeRange.Left = wdShapeLeft
    Selection.ShapeRange.Top = CentimetersToPoints(0)
    Selection.ShapeRange.LockAnchor = True
    Selection.ShapeRange.LayoutInCell = True
    Selection.ShapeRange.WrapFormat.AllowOverlap = False
    Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
    Selection.ShapeRange.WrapFormat.DistanceTop = CentimetersToPoints(0)
    Selection.ShapeRange.WrapFormat.DistanceBottom = CentimetersToPoints(0)
    Selection.ShapeRange.WrapFormat.DistanceLeft = CentimetersToPoints(0.32)
    Selection.ShapeRange.WrapFormat.DistanceRight = CentimetersToPoints(0.32)
    Selection.ShapeRange.WrapFormat.Type = wdWrapTopBottom
    Selection.ShapeRange.TextFrame.AutoSize = True
    Selection.ShapeRange.TextFrame.WordWrap = True
    Selection.ShapeRange(1).ConvertToFrame
End Sub

Need A Code That Alowes Entries In Text Boxes To Be Saved
Hi,

I am very new to VB..
I'm hoping some of you might be able to help me make a code to apply in text boxes made in MS Word 2000..

I have made a document with several text boxes, and saved it as a web page.
When I open the document in IE, I can add text in the boxes, and print it out.

What I would like is to be able to save the webpage with the entered text still in the boxes...
When I save now, and reopen, the boxes are empty..

Any hints?


Brgds André

Collect The Entries Made In A Text Box In A Variable After Each Execution
code for the following steps

1.Declare a variable globally say Var_NEW
2.Store the value in a text field in the variable Var_NEW everytime with a terminating string like ‘;’
3.For Ex: if the text is entered for first time, then the variable holds like VAR_DSN=<FIRST_NAME>; second time VAR_DSN=<FIRST_NAME>;<SECOND_NAME>;

Deleting Double Entries In Text Files. How To? *Not Solved*
I tried with no success to delete double entries in a text file.

I'll explain, I have a text file with the following information:
name, address, phone number
I want to use vb to delete entries with the same name, so I would
have only the latest updated information about that name.

previous help also did not work...

http://www.vbforums.com/showthread.p...hreadid=304157

so I'm still not in my happy place...

any help?

Previous-command Not Going To Previous File
hi guys

i ve a problem in previous command. when i click this button it goes to the first file of my recordset instead of going to previous record. for eg. A, B, C1 , D1, E1, F, G1. if iam in f record at this time when I press prevcmd. it goes to A instead of E1.

help me to correct this coding

Code:Private Sub cmdPrevious_Click()

If Not rstscene.BOF Then
rstscene.MoveFirst
  Call fill
MsgBox "Previous Panel"
End If
End Sub

Code:Sub fill()
Dim i As Integer
For i = 0 To 1
    If Not rstscene.EOF Then
        strPannelId(i) = rstscene.Fields("Panelid")
        panel_txt(i) = rstscene.Fields("Panel")
        Image1(i) = LoadPicture(App.Path & "images" & rstscene.Fields("filename"))
        action_txt(i).Text = rstscene.Fields("Action")
        dialogue_txt(i).Text = rstscene("dialogue")
   
End If
Next i
End Sub

thanks

Search/Replace In Text File Based On Database Entries.
I'm writing an application to take a text file and run a find and replace function on the text based on some entries in a database.  Say you have a text file that is comprised of thousands of lines that are formatted pretty similarly (comma delimited).  I want it to read through the lines and every time it comes across the Product type of Equifax Infile, to change the Category to Developed Report.  And for all Products that are undefined (else) the Category should be set to Developed Report.  The categories and products are saved in a database that is editable by the user.  The Product table contains a foreign key to link to the Category table so as to create a one-to-many relationship.  As I am pretty new to the whole programming world, any help anyone could provide would be appreciated.  I have sample code and text file if you would like.  Please let me know if you have any ideas for this function.  Thank you very much for your help.

Convert More Than 255 Column Entries Of Database, Originally From Tab Delimited Text File
I was looking to convert the data in a tab delimited text file, which when expanded would run upto 295 columns in a ms-access database(two table in access) or two excel worksheets in msexcel. Since the data is tab delimited I am encountring few problems in deciphering the logic. I am using this piece of code for this entire process. CAN ANYBODY HELP ME WITH THIS....Please

PS: the line where variable k checks on numbers is to check the last field in each table defined in local array I find errors hitting when there is a zero-length character in the text field. str(k)="" looks for those.. also there are date datatype defined in the msaccess database there is type mismatch error occuring due to this zero length character as the tab count in the text file increases by 1 always!!

Code:Dim rs As New ADODB.Recordset
Dim tabb As Variant
Dim i As Integer
On Error Resume Next
tabb = Array("Universal_Form", "Employee_Data", "Spouse", "First_Dependent", "Second_Dependent", "Third_Dependent", "Fourth_Dependent", "Fifth_Dependent", "Life_Group", "Health_Questions", "Explanation_1", "Bankers_Life_Insurance")

    Set tx = fso.OpenTextFile(App.Path & "/S1UN003.txt", ForReading)
        While Not tx.AtEndOfStream
            Stop
            str = Split(tx.ReadLine, vbTab, , vbTextCompare)
            If UBound(str) < 295 Or UBound(str) > 295 Then Exit Sub
            j = 0
            i = 0
            For k = 0 To UBound(str)
                If Not k = 36 Or k = 39 Or k = 55 Or k = 71 Or k = 87 Or k = 119 _
                       Or k = 135 Or k = 181 Or k = 209 Or k = 227 Then
                    If tabOpen = False Then
                        rs.Open "SELECT * FROM " & tabb(j), con, 2, 3
                        If j = 2 Then Stop
                        rs.AddNew
                        If str(k) = "" Or IsNull(str(k)) Or str(k) = " " Then
                            If rs.Fields(i).Type = adDate Then
                                Stop
                            Else
                                rs.Fields(i) = Null
                            End If
                        Else
                            rs.Fields(i) = str(k)
                        End If
                        tabOpen = True
                    Else
                        If str(k) = "" Or IsNull(str(k)) Or str(k) = " " Then
                            If rs.Fields(i).Type = adDate Then
                                Stop
                            Else
                                rs.Fields(i) = Null
                            End If
                        Else
                            rs.Fields(i) = str(k)
                        End If
                    End If
                    i = i + 1
                    If k = 37 Or k = 40 Or k = 56 Or k = 72 Or k = 88 Or k = 104 Or k = 120 Or k = 136 Or k = 182 Or k = 210 Or k = 252 Or k = 295 Then
                        rs.Update
                        rs.Close
                        tabOpen = False
                        j = j + 1
                        i = 0
                    Else
                        rs.Update
                    End If
                End If
            Next k
        Wend
    Set tx = Nothing

Help On Displaying Certain Text As A Label In A Form Based On All Entries In Status Field
I have a ExamTaken Table that has the following fields:

1. ExamID as Primary Key
2. ExamDate
3. Score
4. Status. The status field has a combo box that gives two choices Pass or Fail. The status field actually stores an ID which is ID="5" for Pass
and ID = "4" for Fail.

My Question. I have a form that displays all exam ID, the score, date and status. I have a Lable named lable13 at the top of the Form that displays a text msg "Overall Result: "
What I need to do is, if all the status in the status field is Pass then Me.Label13.Caption = "Overall Result: Passed" and If any of the status field is set to Fail then the Me.Label13.Caption = "Overall Result: Failed"

So if there are 6 exam ID and the status field for each ID is selected as Pass then the Label13 should display "Overall Result: Passed" however if any of the status field is selected as Fail for any exam ID then the label13 should display "Overall Result: Failed"

I have included a sample database to give a better understanding on what I am trying to achieve.

Thanks for all you response,
Ket

VB To Check For Entries/not Entries On A Form
Helooo

I've been writing a reporting tool in Excel. I have hit upon a problem though. One part of the tool is a form users fill in to log system faults at work. Unfortunatley, if they leave a field blank, it buggers up the way the tool works later in the report.

I need to have a Sub that can look at each of the 5 cells, and either fill them in with something like "Not-set" or bring up a message box and stop the macro, so the user can fill it in.

Below is the code I'm trying to use.....


The problem is, once the code reaches the 'Call saveandupdate' command, the next Sub starts, and if there is more than one blank field, it is ignored....

Can anyone help, or suggest an alternative?

Thankus Muchus.

Chris~
Code:
Function validateCell(celladdress As String) As Boolean
If IsEmpty(Range(celladdress).Value) Then
validateCell = False
Else
validateCell = True
End If
End Function

Sub validateAll()
Const issue = "E12"
Const custnum = "F12"
Const Timedate = "G12"
Const ISP = "H12"
Const IP = "E17"
Const Notes = "F17"
Dim valid As Boolean

initialise:
valid = True

If Not validateCell(issue) Then
valid = False
Range("issue").Select
ActiveCell.Formula = "Not set"
End If

If (valid = True) And (Not validateCell(custnum)) Then
valid = False
Range("F12").Select
ActiveCell.Formula = "Not set"
End If

If (valid = True) And Not validateCell(Timedate) Then
valid = False
Range("G12").Select
ActiveCell.Formula = "Not set"
End If

If (valid = True) And Not validateCell(ISP) Then
valid = False
Range("H12").Select
ActiveCell.Formula = "Not set"
End If

If (valid = True) And Not validateCell(IP) Then
valid = False
Range("E17").Select
ActiveCell.Formula = "Not set"
End If


If (valid = True) And (Not validateCell(Notes)) Then
valid = False
Range("F17").Select
ActiveCell.Formula = "Not set"
End If



' Call SaveandUpdate


End Sub

Copyright © 2005-08 www.BigResource.com, All rights reserved