Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programmable applications with VB?

Status
Not open for further replies.

NW

Programmer
Feb 3, 2000
61
GB
I’m new to VB & using t for the last 5-6 months to create small applications. I have seen the power of VB for this short period & strongly believe that there must be a way of building a programmable (data capture application using it with VBScript language.

Before my questions, I’ll explain what I have planned so that you have a basic background about the application.

I have decided to divide this application into 3 main areas (applications).

1. StructureApplication
At this stage users allow to create a structure file (.DAT) with few built in validations (i.e. field
Lengths, field types, MustKey etc. etc.)

Current structures of these .DAT files are as follows.

Position
Pos 1-25 Label for text box
Pos 26 Line# used to determine where to place the field
Pos 27 field type (N=Numeric,C=Char,A=Alpha)
Pos 28 Must key field (Y/N)
Pos 29 Visible (Y/N)
Pos 30-34 Range (apply only if pos 27=N)
Pos 35 Same form (if Y then field should display in the
current form if N should be on the next form)

Here is a sample of a DAT file.
Title 1CNY Y
First name 2CNY Y
Last Name 3CYY Y
D.O.B 3NNY N
No of items Purchased 4NYY01-10Y

2. ProgramApplication
At this stage users (probelly a programmer) allow to build form(s) using above .DAT file (form(s) should visible it to user at this stage – same as a normal VB FORM) & write their own validations using VB script for each field. (Hoping to save these validations in a separate TXT file or an Access.MDB)

3. DataCaptureApplication
At this stage data-entry operators should allow to enter data using form(s) created in above step 2 (along with built in/user validations for each field)

And finally here my questions... hope someone knows the answers & like to help.

How to invoke built in validation? (i.e. if pos 28=“Y” (MustKey) then that field shod not left blank at DataCaptureApplication

Can I build form(s) without using Visual Basic in step 2? (Forms consists only text boxes & labels)
If yes pls. give me an example of how this can be done.

Any help would greatly appreciated.
Thanks you very much for your time.

 
When you build a form in VB, the components that you place on the form have Events.
One such event of a text box is the _Validate event which can be used to check the input made in the text box.

What I would suggest to solve your first problem is to have a boolean variable (bEntryRequired in my code below) to indicate whether or not an entry is needed, then in the _Validate event of the text box (named txtBox in my code below), have the following code:

If (bEntryRequired = True) AND (Len(txtBox.text & "") = 0) Then Cancel = True

Simon
 
Thanks for the reply. I will try that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top