×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Micosoft Access Question.

Micosoft Access Question.

Micosoft Access Question.

(OP)
This question is about Access 2000. I have a form with lables, text boxes, etc. which is linked to a table. If the table is empty (no records), then when the form comes up there is nothing on the form even the lables. But, when I populate the table with some records then the table comes up fine. I do not understand this behavior, I appreciate your comments.

Ali

RE: Micosoft Access Question.

When a form that is bound to a table initially loads, part of the initialization process is the populate the controls.  Since the form's recordset is empty, the initialization fails.  One workaround is to add a record to the table in the Form_Load event of the form.

CODE

Private Sub Form_Load()

   If ((rFrm_Form.Recordset.BOF) And (rFrm_Form.Recordset.EOF)) Then
      With Me.Recordset
         .AddNew
         .Fields("<one of the fields>") = <default value>
         .Update
      End With
   End If

End Sub

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein

RE: Micosoft Access Question.

(OP)
Thank you for your response. But shouldn't I receive some kind of error? Personally, I think the correct behavior is for the form to come up with empty textboxes rather than fail to come up if there is no record in the table.

Ali

RE: Micosoft Access Question.

That's a fair question, but one that should be directed at the Access 2000 Development Team.  As far as I know, that's just the way it works.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein

RE: Micosoft Access Question.

I have had this behaviour occur with .mde databases that were opened from ZIP files without being extracted but never before.

Gerald Austin
Iuka, Mississippi
http://www.weldinginspectionsvcs.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources