Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Aug 2003
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Clear Form Code (Access 2003)

    I apologize in advance for this very simple question. What Code can I put into the "Load" Procedure of a Form which clears all fields upon the loading of the Form without affecting any of the associated database records? Will this code also work for subforms? Thanks!

    Bob Nichols

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Clear Form Code (Access 2003)

    If you clear bound controls, you definitely will affect the record bound to the form. If you simply want to open the form or subform for data entry, and not display existing records, you can set the DataEntry property of the form or subform to True and it will open without any visible records. If you have something else in mind, post back and someone will be able to help.
    Charlotte

  3. #3
    New Lounger
    Join Date
    Aug 2003
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Clear Form Code (Access 2003)

    Thank You Charlotte:

    I want to use the fields in the subform to merely lookup names and telephone numbers and then copy the results into corresponding fields in the main form. I want to lock the subform fields so that data cannot be changed as it comes from the main client table in my database.

    The subform field of "CLN" will be copied into the "CLLN" field on the main floor. In VB6 I would merely write the following Code, CLLN.Text = CLN.Text, but that Code will not work. Any suggestions? Thanks!

    Bob Nichoils

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Clear Form Code (Access 2003)

    In that case, I'm not sure what you're asking. Which form are you trying to clear? You can certainly lock the subform controls by setting their individual properties or you can lock the subform itself the same way. The Text property of a control doesn't work the same way in Access as in VB. In Access, you can only refer to the text property of a control that has the focus and the property is read-only. You use the Value property in Access, but since it is the default property, it is often left off and the code is written like this:

    CCLN = CLN

    If you are running the code from one form or subform and referring to the other, you have to expand that. If the code is being run ffrom the parent form, it would be something like this (assuming fsbSubForm is the name of the subform control - not, please not, necessarily the name of the subform itself:

    Me!CCLN = Me!fsbSubform!CLN

    If you're running it from the subform, it would be:

    Parent!CCLN = Me!CLN
    Charlotte

  5. #5
    New Lounger
    Join Date
    Aug 2003
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Clear Form Code (Access 2003)

    I am sorry for piecemealing my problem, but I thought one answer would lead me to another. Please understand I only write here as a last resort. I have tried every thing I know over the last couple of days. Here is my entire scenario.

    I use VB6 to access my Microsoft Access 2003 database and insert data into Microsoft Word Documents. I also use VB6 to edit my database and prepare legal pleadings. I prepared a "Telephone Input Form" in Microsoft Access 2003 by which my staff can record information from telephone calls (approximately 200 per day). Inputing directly into Microsfot Access forms is much faster than doing so in comparable VB6 forms. My Microsoft Access "Telephone Input Form" contains two subforms which access data from my "Client" Table and "Attorney" Table. I have these subforms look up certain clients and attorneys all ready in my database when they call. For instance, If a client calls the secretary does not have to manually type in all the information. She merely finds the applicable "Client Record" from the "Client Table" and inserts that information into the "Parent Form" which is linked to a "Telephone Contact " Table. Since my staff has been known to inadvertantly alter the records from the sacred "Client Table", I want to lock it in this Form. Unfortunately, if I lock so much as a field linked to the "Client Table", all of my VB6 programs accessing the same table do not work. Thus, a secretary entering information in the "Telephone Input Form" locks out a secretary writing a client a letter using the VB6 program which accesses the same "Client Table".

    My question is, "Can I protect (or make uneditable) a field in the "Telephone Input Form" and not "lock" out other users accessing the same table through VB6?" You do not know how much I would appreciate any suggestions! Thank you!

    Bob Nichols

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Clear Form Code (Access 2003)

    Can you post a striped down sample of the Access database in 2002 format and with any proprietary data removed? I don't have 2003 yet and won't until at least the first service pack, but someone else may have or we may be able to work out the problem in 2002. As it is, I'm having trouble envisioning what you're trying to do. It sounds like you need to modify the Access forms to select and display information from the telephone contact table but not allow it to be changed. That doesn't require locking the fields, but it probably requires changing the way your forms work.
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •