Link to home
Start Free TrialLog in
Avatar of kenmostafa
kenmostafa

asked on

fields format at design time ??

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...

Avatar of vbDoc
vbDoc

What's the database?
You want to do this user data entry from VB or your back-end, I hope its Access.
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
Avatar of kenmostafa

ASKER

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 !!
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
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
Avatar of DanRollins
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
ASKER CERTIFIED SOLUTION
Avatar of SpideyMod
SpideyMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial