Solved

fields format at design time ??

Posted on 2002-06-20
8
152 Views
Last Modified: 2010-05-02
Hi all :

when Creating anew database, table,fields ... i know that i can assign a fromat for my field's in the table.

the first Field is a "0000000" format , seven digit number .

the second is a "000" format , Three digit number.

the third one is a "hh:mm:ss AM/PM" a Time format Field .

how to do this by code , i've heard that it's something related with the Field Attribut's , but how to set these atributes at design time .

by the way , when <data entry> , i'm solving this problem it's ok for me , but when the user makes any changes in this table i want him to be restrected with the format i specify , and that is done by setting the format at design time for the field's as i expect ...

many thanxxx for ALL...

0
Comment
Question by:kenmostafa
8 Comments
 
LVL 2

Expert Comment

by:vbDoc
ID: 7097378
What's the database?
0
 
LVL 9

Expert Comment

by:Valliappan AN
ID: 7097830
You want to do this user data entry from VB or your back-end, I hope its Access.
0
 

Expert Comment

by:alicelknight
ID: 7099553
kenmostafa:

In a VB Project, on a form, click the control they will be entering data into (i.e. textbox), look in the properties window and set the format in the property called DataFormat.  This is for data-entry on a VB form.

Alice
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:kenmostafa
ID: 7101338
hi all :

sorry for lating , but there's a couple of things that i have to get clear :

1 - i'm connecting with Access2000
2 - first the data entry trick is solved and no problem
    so no way for entering wrong formatted data in the text
    box's .
3 - now , i'm giving the user permision to change entries
    through a Dbgrid control , so here i want to restrect
    the user Entry , as i explained befor to fit the format
    that i wanted , if not , an error message must pop up
   

i think its clear now for all , and many thanxxx for replying !!
0
 

Author Comment

by:kenmostafa
ID: 7101441
Hi all :

i've solved the problem by my self...
i've tried the following , to test the user's entry :

Private Sub DBGrid1_BeforeColUpdate(ByVal ColIndex As Integer, OldValue As Variant, Cancel As Integer)

select case colindex

case 1 ' this is a "000" format Field
if (entered) <> (what i want) then
msgbox "Error"

dbgrid1.text = oldvalue
exit sub

and so on for the rest of the fields

End Sub
0
 

Expert Comment

by:alicelknight
ID: 7101630
kenmostafa:  Glad to hear that you solved your problem.  I do not know the rules for deleting the question, but as for me, I do not care if you do.

Alice
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7923675
kenmostafa, an EE Moderator will handle this for you.
Moderator, my recommended disposition is:

    Refund points and save as a 0-pt PAQ.

DanRollins -- EE database cleanup volunteer
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
ID: 7968413
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Reading the Contents of a Directory In Access VBA 5 77
Exit a vb6 apps when a calling it apps closes 15 52
vbModal 12 57
pop out of webbrowser1 control vba6 5 26
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question