Validate Time Data Entry
Does anyone have an isTime type function to validate that data entered into a text box is a time - ie: hh:mm am/pm?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Validate A Textbox Entry
i need to validate a textbox that must accept only 12 integers when data
entaring. eg :- (124578934509) This must not accept character values please
This email and any attachment hereto is for authorised use by the addressee
only. It may contain confidential or priviledged information and/or
proprietary material. If you are not the intended receipient , this email
and/or any information it contains should not be copied, disclosed,
retained or used by you or any other party, and the email and all its
contents should be promptly deleted fully from your system and the sender
informed. Thank you.
Validate Email Address Using MX Entry
Dear VB Guys,
Take regards. I'm wondering if anyone can help me in this problem.
What I want to do is validate an email address using MX entry. Say, firstname.lastname@example.org is an email address. I want to know if the account emran really exists in hotmail.com's server.
I've heard about the term MX entry somewhere and wondering if this can help. Also I'll be glad if there's any other method.
That's all for now. PLZ help me if you can...
Md Emran Hasan
Validate Textbox Entry In Userform
I want to check to see if a textbox entry is valid and prompt the user immediately with a message box if they make an invalid entry. I am trying to use the "Exit" Event procedure but I'm having difficultly getting it to work. I don't really understand what (ByVal Cancel As MSforms.Returnboolean) means.
[validate] Check DB For Duplicate Entry
Hello all, this is my first post on the forum.
Here is my situation: I have created a MS Access DB, and I need to check the value of a textbox, against the current database entries.
I tried to create a class that would do this, but I must admit my VB skills are very poor, and thus I've decided to figure out how to do this in the event first, then when it works I can have fun making it a class
So here is what I tried, but obviously dosn't work:
cStringCommand = "SELECT drawings.`Job number`, drawings.`Drawing number`, " & _
"From drawings " & _
"WHERE drawings.`Drawing number` = " & drgNumber & _
"AND drawings. 'Job number' = " & JobNumber
cRs.Open cStringCommand, cConn
If cStringCommand = JobNumber Then
MsgBox "No match found"
MsgBox "This drawing is already entered"
Now I know there is a much much better way to code this. Basically, I'm asking, or begging, this code to open a connection, send the results to my cStringCommand variable, then check that variable against the drgNumber and JobNumber vars. I think that what I really want here is a Boolean, if True then.... ELSE..... I know if a crack at this enough I'll get it, I just don't know if I'll live that long I'm not asking for someone to create the code, I just don't really know the best way to tackle this little problem. As I stated, once I get this working, I'll make it into a class (I'd do that right from the get go, but my understanding of classes is shakey). I'm using a book called "Database Access with Visual Basic 6". Great book, I just can't seem to figure out how to validate like this, and I couldn't find it in the book.
How Do You Validate Text Entry To Make Sure It's A Number?
I have text boxes that I need to validate to make sure that a number is being inputted instead of, say, a word. What's the best way to do this? So far i've come up w/ a way to block normal text from being entered, but is there a better way?
"There are a million beautiful girls in the world. Not all of them bring you lasagna at work. Most of them just cheat on you."
~The wisdom of Silent Bob
I need to validate time that is entered into textbox. I intended to do it like that if user types in firts two digits (hours), it would automatically add colon and then minutes are typed. If user presses "backspace" or "delete" then the textbox would be cleared.
Finally when the user presses commandbutton, the time that was entered would be validated that it is in correct format (for example 12:55, not 99:88).
It got kind of comlicated (at least for me). Maybe someone can help?
Thank you in advance,
I'm using a MaskEditBox with the mask ##:##, when the user inputs a desired time into the box, I want to verify that it is a valid time with in a 24hr clock.
Currently the meb is passing an unformated string in....ie...User enters 09:30....the mebTime is forwarding "0930" to the validation sub. I am using the strTime = format(mebTime, "HH:mm") to set it up. However....it will fail and set the strTime to "00:00".
I can get around this by breaking the mebTime in two and inserting the ":". But my real problem is that if the user enter something like "3080"...this will convert to strTime="30:80"....not exactly a valid time.
What am I missing here....It can't require this much checking to validate a time...Or does it?
Dazed and Confused....
the user will have to enter a data into a text box (sample: 231 Pm), and I want to make sure before moving to another box, that the text entered is a valid time.
How can I tell if the user enter a valid time in a text box?
Validate Using The Server Time
This may belong in a different section, but I'm not sure.
I have an application on a SQL Server. It's nearly 100% dependant upon the date. However, some users have a different format (e.g. 07/05/2005 or 7/5/2005). For some reason, the app is thinking 07/... is different from 7/..., even using Format(value, Date). As a result, my daily counter isn't resetting to 0.
The way the counter works is as follows. When a user signs in, their date is checked. If it's different from the table, then the counter is set to 0; otherwise it just continues (+1) from the table. So you can see my problem. Today is 07/06/2005. The value is currently at 186. If I sign in and my system is set as 7/6/2005, then it will reset to 0, even though the day is the same.
So I suppose what I'm getting at is I need a way to validate on the server side or a fool-proof way of doing this. I could create an application to put on the server side that checks the date and when it changes, reset the counter, but I would like to stay away from another application.
P.S. - the "server" is actually just a dedicated workstation on 24/7 with MSDE loaded up.
Anyone have any suggestions?
Function To Validate Time ???
Does anyone know if VB has a built in function to validate times ? I checked for IsTime() but not their. If no function exists, does anyone know how to go about vaidating that data is a true time ?
Validate Time - Using Masked Edit Control
I'm using a masked edit box to prompt the user for a time value. I am having trouble validating that the user entered a correct value. My input mask is: ##:##:## and my format mask is "hh:mm:ss AM/PM". The problem is that the user has to enter a military time for the edit box to recognize a PM time. How can I prompt the user to add ##:##:## plus specify AM or PM and then format the user input.
My validation routine looks like this:
Private Sub mskTimeLow_Validate(Cancel As Boolean)
If Len(mskTimeLow.Text) < 6 Then
If IsNumeric(mskTimeLow.Text) Then
Do Until Len(mskTimeLow.Text) >= 6
mskTimeLow.Text = mskTimeLow.Text & "0"
mskTimeLow.Text = CInt(mskTimeLow.Text)
'verify that it is in fact a time
If IsDate(mskTimeLow.FormattedText) Then
'MsgBox "This is a date" & mskTimeLow.FormattedText
MsgBox "Invalid date: " & mskTimeLow.FormattedText
Cancel = True
but like I said, how do I prompt the user to specify AM/PM. I do not want to force the user to enter military time.
Day && Time - Select Entry From INI
Hey Guys & Gals,
Run into a bit of a brick wall with my project. I am wanting to include a method that will grab todays day and the time (based upon 24-hour clock), then it will grab the correct entry from an INI file.
For example, it would grab todays day (Monday), grab the time for example as 3PM (15:00), then grab the correct entry from an INI file based on the time and day, like this:
15=Listen To Music
23=Go To Bed
I then want it to display on a label, like: NOW: Listen To Music. Also, is it easy to add another label to show the next event? NEXT: Walk Dog
Anyone got any ideas how I go about tackling this?
Time Sync Entry
I have two timers. One tells Label1 to show the computer time and the other timer matches what text box says with the Lable and if they match it opens another program. My problem is that for it to work everytime I have to use military time and add a space after the textboxs user entry time. Any way I can make that simpler. I know what I just typed is really confusing, but look at it from my point of view, what I have to enter is confusing and barly works.
Private Sub Timer1_Timer()
Label1.Caption = Time
Private Sub Timer2_Timer()
If Format(Label1.Caption, "hh:mm:ss") = Format(Text1.Text, "hh:mm:ss") Then
Shell "explorer http://www.dc101.com/jacor-common/newtuner/HWTuner.html"
Thank you for any help you give me.
DatePicker Used For Time Entry
I have used 2 datePickers to enter a StartTime and EndTime. They are working fine and the data is being saved in the Database (Access), however it is being saved with the date as well. Therefore when I get the data out and display it in an MSFlexGrid it shows the date when I only want to see the time component.
Is there an easy way to strip the date out before saving ??
Format Textbox For Time Entry
I've got a textbox and I'd like the format to be displayed as the user types in a time.
Say you want to type in 10:30:36..........u can just type "103036" and the textbox automatically puts in the ":" and sets the format correctly as the user types.
I'd like to know if there is an easy way to accomplish this (using the Mask Edit Control maybe) or if I have to use the Keypress event of the textbox control and do it the long way?
Time Stamping Entry Into Excel
Is it possible to create a time stamp when sending data to an Excel spreadsheet so that it can appear in the data the goes into a spreadsheet?
ok i have a few text boxes which users enter in valuses then mathematical calculations are done
how do i validate it so if the user enters in anything else than
0 - 9
a msg box will pop up sayin "only numbers are allowed"
sorry if you found my question "silly"
but i really have no brain today.
how are we going to validate data entered in a text box?
ex. i have a textbox and it should contain
how does the program will reject the entry
if doesn't contain the "@" character?
please help. i need this today.
I am a DBA, I am writing a vb code that connects to MS SQL server 2000 database table which already has data in it. Now, what I want to do is to write a vb code that will check for inconsistencies in my data set. Data is already in a table, so when I run a program, it has to check every line of record for the inconsistencies I want to cehck and wriote the message to a .txt file.
eg. If !marriage = 1 and !age < 15 then message is, "too young to be married.,I want this to happen to every record in a household. I am writing this to validate a survey data in my country.
Or is there another software that I can use to do this.
2 Data Entry Forms Appending && Inputting Data
I have a problem that I am totally stumped on - can someone help me figure out what I have done wrong?
I have 2 form objects, 1 for a user to enter data into, and 1 for user feedback after form has been submitted.
(Form 1) Data entry form consists of user last name (text box), user first name (text box), and popular TV show (list box of shows I will enter - lstDataEntry).
(Form 2) Feedback form consists of thank you label and a list box (lstDataOutput) with user's last name, first name, and popular TV show that user selected from data entry form.
On form 1, I have a File menu with sub-options of Submit, Clear, and Exit.
Also in data entry form, I want to open a file called data.dat in append mode and to message box what the user has entered and selected.
On form 2, I want to thank user for submitting data (in the label), and I want to display the contents of data.dat.
From form 1, I want to read my data file and display the output on form 2 by: opening data.dat in input mode, using a Do While loop (reading records from data.dat until I get EOF condition), and appending my data to form 2 for output.
This is my first try at menu items - the books I have read about this are not very in-depth and I am very confused.
Can someone please offer some suggestions? I keep getting error messages and I cannot even get to the point where I can see if my 2nd form will even come up correctly. The error message is in red "varible not defined" but I don't understand how to define it and assign it a value with it being on my 2nd form. (2 problems - defining/assignment statement for lstDataOutput and is code correct for inputting and appending data file).
By the way - where I have "pathdata.dat" - I just did not include my entire path here.
Thanks for any help you can offer - I appreciate it.
Private Sub mnuSubmit_Click()
Dim strShow As String
strShow = lstTv.List(lstTv.ListIndex)
Open "pathdata.dat" For Append As #1
Write #1, txtLastName.Text, txtFirstName.Text, strShow
If optComedy = True Then
MsgBox ("Your favorite type of movie is comedy")
ElseIf optDrama = True Then
MsgBox ("Your favorite type of movie is drama")
ElseIf optSuspense = True Then
MsgBox ("Your favorite type of movie is suspense")
ElseIf optMusical = True Then
MsgBox ("Your favorite type of movie is Musical")
MsgBox ("You did not select a favorite movie")
MsgBox ("Your data has been saved." & vbNewLine & txtLastName.Text)
'Load & display 2nd form
Dim strLastName As String
Dim strEvent As String
strShow = lstTv.ListIndex
Open "pathdata.dat" For Input As #1
Do While Not EOF(1)
Input #1, strLastName, strShow
Private Sub Form_Activate()
Dim strThanks As String
strThanks = lblThanks.Caption & "Thanks to you for submitting your information. Output below indicates all data that you submitted currently."
TxtBox(array) Data Entry Into Data Control
I have a Form that has an array of text boxes tied to an Access database with a DAO data control. This form will allow the user to add a new record in the database. Each text box on the form is tied to a certain field.
My question is what is the best way to have the user enter data?
Do I have the Form come up with the last record in the database with a control button saying Click to Add record? Then when you click to add record - of course it would be Data1.Recordset.AddNew but you still have to add another button telling the computer you are finished typing in the information - that 2nd control would be Data1.Recordset.Update.- right? I don't know.
Do I have the Form already come up with blank text boxes- already adding a new record to the database? That still won't add the information - I have to give the user time to input the new data - I still have to place a control button telling the computer that the user IS finished entering information - I'd assume to place the Data1.Recordset.Update code there.
I have tried both ways the above and the datacontrol hasn't worked for some reason. It seems to not recognize the other when placed under two separate Private Sub commands.
Now I'm trying ADO and learning a little more about assigning variables to the database itself. But I still have to come up with the proper way for the database to accept input. I've got everything working the way I wanted to on this program except to add one simple record. My brain is fried please help...sorry about so many posts on the subject but I really need help with this one. Thank you all for your replies and expertise.
I Can't Disallow The Entry Of 2 Identical Date And Time
I have a form that allows the user to take an appointment, so I must not allow the entry of 2 identical date and time to my database.
I wrote the following code into my form but it seems that my application is just ignoring it and the user can still take 2 appointments at the same date and time!!!!
What's wrong with my code?
Do you think I should do something about the date and time format?
Set rsappointment = dbappointment.Execute("select * from appointment")
Do Until rsappointment.EOF
If (rsappointment("app_date") = "& txtdate.Text &") And (rsappointment("app_time") = "& txttime.Text &") Then
MsgBox "An appointment is already taken at that time. Please choose another."
Else: GoTo SaveInDatabase 'THE SQL THAT INSERTS THE RECORD IN THE TABLE
Validate Pasted Data
Quick newbie type question:
I would like to be able to trap non-numerical data entered into a textbox via CTRL+C and/or Shift+Insert.
I realise that this data can be validated using the TEXTn_validate event but I would like to stop the user before it gets that far.
Thanks in advance.
How To Validate Data In A Grid?
I have a vb grid(MS Flexi Grid1) and just wondering how to validate the data inserted in the grid.Can I use IF statement?
Please suggest with example...
Where To Validate Object Data
Whats the best way of performing object validation before a database call?
Eg: I have a class, clsUser, and have scenarios like:
User.name = "John"User.surname = "Peterson"User.DateOfBirth = 11/05/2005if User.Update = false then 'errorend if
This worked because the Update() method called a private method, ValidateUserData, that would check all the object properties to make sure that proper length strings, and valid dates were entered before continuing with the actual update procedure - if any data was invalid, the method would return false before even attempting to connect to the db.
Now i'm looking to move the sql out of the user object, and use a mapper object to peform CRUDS :
User.name = "John"User.surname = "Peterson"User.DateOfBirth = 11/05/2005if not UserMapper.Update(User) = true then 'error messageend if
So i was wondering where i should perform object validation - in the UserMapper before an insert / update?
Validate String Data...
What would be the best way to validate a string data input with VB?
e.g - a password may only contain letters or numbers in any combination?
I've tried using the Like operator, but am having no luck with it...
Validate Data In Text File
I am attempting to read in a text file that the user has uploaded to my site. I am trying to make sure, before storing into my db, that the character fields only have normal character text in them(a-z, 0-9). I know of intensive ways of checking this (such as checking each letter for an appropriate ascii value), but I know there must be a better way. I would love it if I could find a function (like isnumber), that would check an entire line for valid character data (a-z, 0-9). If I can't check for these values, any valid string data (including ?<>:, etc.) would be fine, just ignoring arbitrary values would be sufficient (ascii values 128-255, for example). I thought that just doing the readline() function, and putting the value into a string field would work, but I ended up with garbage in the field, which screwed up the database.
Most of my research has shown up validating text fields on a form, with the answer usually being to validate each character as it is entered.
Any help would be appreciated. This seems like a problem that everyone would have at some time or another, but I just can't seem to find the right answer.
Does Any Know About The Data Control Validate Event
I can use a text box validation, but need to change this so that it uses the data control valdiate event instead. I think I need to change my texts boexes to look at the recordset but it then did not like the caancel = true. Tried to change from
Private Sub txtField_Validate(Index As Integer, Cancel As Boolean)
If Val(txtField(2).Text) > 20 Then
MsgBox "Category must be between 1 and 20", vbOKOnly, "Category"
Cancel = True
Private Sub datStock_Validate(Action As Integer, Save As Integer)
If Val(datStock.Recordset.Category) > 20 Then
MsgBox "Category must be between 1 and 20", vbOKOnly, "Category"
'txtField(2).Text = ""
I have tried to change this to the datacontrol validate event instead and where I have my text box array change to rdatstock.recordset.Category(or which evey field name I need) and to remove the cancel=true to datstock.recordset.cancelupdate, but I end up with a run time error of:
Runtime errorUpdate or cancelupdate without addnew or edit.
I tried changing this to:
If Val(datStock.Recordset.Category) > 20 Then
MsgBox "Category must be between 1 and 20", vbOKOnly, "Category"
'txtField(2).Text = ""
The problem is, both will work but wjhen I go back over this the recordset comes up with the message box and then the 3020 error.
Has anyone come across this before?????
Any help gratefully accepted.....
Validate If The Data Already Exist In The Database Before Add
I have a datagrid in a form. If the user try to enter a data that already in this table I have to validate it and stop the updating or the adding. I tried the evens
DataGrid1_Validate but it seems that it doesn't work.
I use recordset . This is my code for one of the 3 sub.(this may differ from the 2 others depending on the value that I have to return (Cancel))
Dim RsJobValid As Recordset
Set RsJobValid = New Recordset
RsJobValid.CursorLocation = adUseClient
RsJobValid.Open ("Select * from TblJob where job = '" & Me.DataGrid1.Text & "'"), MyConn, adOpenStatic, adLockOptimistic, adCmdText
If Not RsJobValid.EOF Then
MsgBox ("This job already exist, please try again.")
Cancel = 1
Thanks in advance
Validate Data Entered In TextBox
I am having a problem....I need to validate the data entered by a user in the textbox,i.e. to check for a directory existence/folder existence & prompt the user if its not there.
e.g If the user enters "d:ads" How can I validate that the user has missed out the blackslash after drive letter?
Validate And Export Excel Data To Access Using Vb
My data comes in the form of an Excel sheet through Email.
I have to exract data from excel sheet and import into access table using vb.The excel sheet data is all over the place.
Can anyone Help Me!!!
any help is appreciated
Validate Input Data In Three Tiers Application
I develop a three tiers application in VB6 and I have a big question.
Where have I validate input data: in the form code or in the business object cod?
I have only to validate the type of data and if the data is filled - for the fields that canít be null.
Data Control : Validate Event : ACTION = 15 !!!
I am rewriting a old 16 bytes VB3 program under VB6.
Managing a database, I get an error message Nr 438 ("Object doesn't support this property or method") I suppose that this "unknown" object is one of my bound controls. Which one ???
When this message is displayed, in fact, the VALIDATE EVENT of the Data control is fired with ACTION = 15 (and SAVE = FALSE).
WHAT IS THIS ACTION WHICH DOESN'T EXIST IN THE VB HELP ???
Any idea ?
To Validate The Textbox For Input Data Type
I am having a text box in my form .In that i have to check whether the value entered is string or number and to display message.Is there any function like "isalpha or isnumeric" to do this
How To: Data Entry From
First post (of many probably)
Some background: 20 years of UNIX/C, only 4 months of OOP
I'm using VS.NET 7, VB windows form application
What would be the best approach for building a data entry screen for entering invoice details?
Assuming a minimum of 2 columns: product & description
Assuming unlimited rows
On each row one should be able to pick a product (combo box, drop down list or something of that nature), have it's description show up in the description column on the same row.
Is a Datagrid apropos?
For what it's worth, my data comes from text files, read in via fileget, which can populate a simple array or any other data structure that is appropriate for the task.
Some guide lines / suggestions would be appreciated !
I am looking to have a user enter alot of data onto a form. Is there a way to create a table that when the user enters data into it, it updates a tablein the database automatically.
Data Grid Data Entry
I am currently creating "cash register" for my school project.
I never see find VB books that imply in using "data grid" as means of data entry. But when I went to a departemnt sote, I saw the cashier used datagrid (or maybe something that looks like it) as a way to enter the item code. Now, I started to get confused, since I couldnt find any resource to lead me in using DataGrid as a way to entry my data then stored into the database. thank you
Data Grid For Data Entry
I'm useing Data Grid for data entring. I use coding insted of ADODA data
control. But I can't do any typing (editing) the cellpointer. pls
help me any one who familiya with dara grid
Grid Data Entry
I'm relatively new to VB6 and need some help. I'm creating an interface to another program which will receive several repeating parameters. I want to use a grid type control and let the user enter values into the cells. Everything I have found allows the program to insert data but won't allow me to make the cells editable. Any help would be appreciated
Access Data Entry
I have a phone numbers program I made in Access that divides everything by category.
The categories are tied into a relationship with other tables.
To add a name and number you first enter the category you want to go to and it pulls up the data in a datasheet form.
I want the user to be able to type in the Name and Number but not have to type the Category for the record - since the category will be the same for all those listed in that datasheet.
I am pretty sure that I have to go to the properties of the form and punch in a code at On Key Press to check for data entry on the last record. Is there an easier way to do this? If not, what would be the code to check if there was an entry on the last record and if so, what is the code that would allow me to make [CategoriesID]= [CategoriesID-previous record?]
Thanks for all your help!
Data Entry Only Through Forms
Kindly advise how I can restrict spreadsheet users to view/edit/print various ranges in my workbook ONLY through vb forms that I have created (users should not be allowed to manipulate data/ranges without using the forms).
Easiest Data Entry...
I'm making a spreadsheet to enter the names of drugs. I have a list of them, several hundred in all.
I'd like the user to be able to click in a relevant cell, type a letter, be brought to that part of the list, type another letter, get closer, etc.
What would be the best way? Some methods I've tried (validation) will make the list, but won't bring the user close to the intended value. Given the size of the list, the closer the better.
Ado Data Entry Sorting?!
On of my forms consists of entering customer information, the information is saved to a database, but when i scroll through the records, the first record is located at the end of the list and the newest record is located at the beginning. How can i make it so that The first entry i have made will stay at the begining?
This is the code for my save button:
Private Sub cmdsave_Click()
Would i require additional code here? or in my form load?
any help apreciated!
Data Entry Question
I am a new programmer of VB. I have the following question:
How can I make a spreadsheet-like interface for data entry and enable user to copy a group of cells from Excel spreadsheet and paste in the interface as input??
Data Entry Grid
Hi. I'm trying to find or make a control which is a grid for Data-Entry. I don't want to link it to a data source, but I do want to be able to, for example, validate the entries when the user moves from one column to the next (same row) I have looked at TrueDBGrid, but that will only validate when the row is complete (- as far as I can see, in application mode, do say if you know different...)
Any ideas? your help is muc appreciated.