tabular form

R

rathika

hi

in a tabular form, even though i have taken care of
avoiding null entries for all the controls it still
allows for noncurrent record. how do i avoid this.

pls help

rathika
 
I

Ivar Svendsen

Hello.

The best way to keep the user from leaving a field blank
is to set the "Required" and "AllowZeroLength" properties
in the table definition. By setting Required=True and
AllowZeroLength=False you make Access do the check as the
data is entered.

Also using the form control's ValidationRule and
ValidationText properties will case the check to be done
on the field when the user has changed it's data.

If you need to run a more complex validation on each line
of the form, you can try this code:


DoCmd.RunCommand acCmdRecordsGotoFirst
while not NewRecord
' Validate the fields

' Move to next
DoCmd.RunCommand acCmdRecordsGotoNext
wend


- Or -


Form.RecordsetClone.MoveFirst
do while not Form.RecordsetClone.EOF
' Validate the fields
if not Valid() then
MsgBox "Message"
Bookmark = Form.RecordsetClone.Bookmark
exit do
end if

' Move to next record
Form.RecordsetClone.MoveNext
Loop



The first version cause Access to change the current
record of the form autmatically so that the user can see
which record is currently beeing validated.
Because Access redraws the whole screen, this can be quite
slow, especially if you have a back-end database running
on a network fileserver. The second version will be much
faster because Access will not update the screen unless
finding an error.




Regards,
Ivar Svendsen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top