1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Why does my code only work once when I open the form?

Discussion in 'Business Applications' started by Jayabhadra, May 18, 2012.

Thread Status:
Not open for further replies.
Advertisement
  1. Jayabhadra

    Jayabhadra Thread Starter

    Joined:
    Feb 13, 2012
    Messages:
    52
    Hi,

    I have a database to be used by people completely new to access. So I made the access window disappear, and add 3 buttons: add record, save record, and delete record.

    But I found that when I open the database (which show only the main form), all three buttons only work once. For example when I add new record, then I save. And I cannot add another new record, I pushed the button but it doesn't respond. So I close the form (which brings back the access window) and reopen the form, and I can add another one.

    Does anyone know how to fix this? Lots of thanks.

    JB
     
  2. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    19,840
    As I said in the Private Mail you do not need a save button.
     
  3. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    19,840
    The mistake that you have made is a common one and one that I have made quite a few times. :(
    The Home mainform is based on the T1_Profil table, but the first tab contains a seperate Subform also based on the t1_Profil table. When you add a record it creates a conflict between the Home form and the Subform preventing any more entries. The data on the first tab should be just the fields from the t1_Profil table and not a subform.
    I have corrected the first tab and added some records using the new button.
    I am posting this answer on the forum, because I am sure many others will create a subform for the Tab instead of just adding the required fields from the Home form's Recordset.
     
  4. Jayabhadra

    Jayabhadra Thread Starter

    Joined:
    Feb 13, 2012
    Messages:
    52
    It's just perfect!! Can you tell me what to do to fix the problem?

    Because I have done some other reports in the file and i wanna fix the issue in my newest database. So I wont make another mistake in the future.

    Thanks OBP!

    JB
     
  5. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    19,840
    This is only required where the Mainform & subform use the same table.
    Select all the fields on the subform and "Cut" them.
    Delete the subform.
    Highlight the Tab.
    Paste the cut fields and save the form.
     
  6. Jayabhadra

    Jayabhadra Thread Starter

    Joined:
    Feb 13, 2012
    Messages:
    52
    Thanks, but I am Not on my desk right now, i'll check when I got back.

    Can you help with another one OBP:

    I create a query Q1_CSMS which compute the total score, including the valid & expiry date for the score.
    Then I made a form from that query, which is F3_REKAP.

    If I made changes to the query (Q1_CSMS), the formula in F3_REKAP > recordset is not updated. So it is true in the query datasheet view but still wrong in the form.
    when I change the formula in the form recordset, The form show the right value.

    Is this normal that the query and form's recordset is not connected? Or I should do something to connect the query to recordset? So when I update the query, the form is also updated.

    Thanks OBP,
    JB
     
  7. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    19,840
    The query recordset & the form recordset are connected if the Form is bound to the Query, ie the query is the form's Record source.
    But if you add fields or calculations to the query those changes will not be reflected in the form.

    By the way I sent your database back to you with the fields on the form Tab.
     
  8. Jayabhadra

    Jayabhadra Thread Starter

    Joined:
    Feb 13, 2012
    Messages:
    52
    By the database you sent, do you mean the one you had fix with add_record button?

    I see.. so the problem is that because my REKAP form is based not based on Q1_CSMS only.
    I did that to include 'attachment' field which is stored in T2_CSMS. Originally I want to put that in the F2_CSMS form, but as you can see, the F2_CSMS form has already reached its limit on the number of field stored, so I cant put anymore field there.

    Do you have any suggestion to this issue?

    JB
     
  9. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    19,840
    I am not sure what you are asking me.
    I looked at your CSMS table and I don't really know what I am looking at with all those fields with similar names like
    DA_1
    DA_2 etc
     
  10. Jayabhadra

    Jayabhadra Thread Starter

    Joined:
    Feb 13, 2012
    Messages:
    52
    never mind OBP, I got it solved already. used a little trick, lol..

    Thanks for your help OBP, I'm gonna find you if I found another issue okay? :) Thx a lot!
     
  11. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1053792

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice