Results 1 to 12 of 12
  1. #1
    3 Star Lounger
    Join Date
    Nov 2003
    Location
    London, Gtr London, England
    Posts
    222
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Data Input Form (2000 (9.0.4402 SR-1))

    I am proto-typing a form to allow users to input new policies to a temporary table ("tbl:CW Working Report Input") prior to them being uploaded to a larger table. After the upload, the data within this table will be written out to a log table and subsequently emptied. The basic input form with a subform that lists the entered policies, works fine without any problems.

    I've now moved to the next stage by ensuring the users enter data into each of the fields in turn and returning them to a field which has no data entered, either by performing a check when another field is selected out of turn, or if the next record button is clicked on the built in record selector bar before the record is completed.

    When the built in next record button is pressed, the subform updates the list with the new record and the main form is blanked ready for the next record to be entered.

    This is where my problems start. The focus remains at the Syn field, whereas what I would like is for it to automatically move back to the start of the record at the ContractNo field. If I try selecting the ContractNo field from here without completing the field, then my blank field messaging springs into action.

    I've tried a number of things to auto set the focus back to the ContractNo field, but I've managed to do this, I've ended up with a new set of problems such as the main form not blanking or the subform not updating or both.

    Attached is a cut down DB with the forms and tables attached to it. I would be most grateful for your advice in solving the immediate problem and as to whether I'm actually going about this in the right way. The main form is "F:New Collection Input" and the subform is "sbf:New Collection List" and I've left one line of data in the "tbl:CW Working Report Input" table.

    Cheers,

    Niven

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Data Input Form (2000 (9.0.4402 SR-1))

    Added: I don't understand why you have a main form and subform. Both are based on the same table.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Data Input Form (2000 (9.0.4402 SR-1))

    Some general remarks (applicable to any database):
    <UL><LI>Turn off Track Name AutoCorrect Info in the General tab of Tools | Options...
    <LI>Give each table a primary key.
    <LI>Create relationships between the tables and enforce referential integrity.
    <LI>Set Subdatasheets to [None] for all tables.
    <LI>Avoid spaces and punctuation (except underscores) in the names of database objects, controls and fields.[/list]Some specific remarks:<UL><LI>The field Combined in tbl:CW Working Report Input is the combination of ContractNo and CollNo. This makes it redundant.
    <LI>Group and RITech are determined by syn, so they don't belong in tbl:CW Working Report Input.
    <LI>Don't use the On Lost Focus events to check if controls are null.
    <LI>Don't use the After Update event of the form to check if controls are null, use the Before Update event instead, and set Cancel = True if one of the controls is null. Also set focus to the first blank control.[/list]Not checking in the On Lost Focus events should take care of your main question.

  4. #4
    3 Star Lounger
    Join Date
    Nov 2003
    Location
    London, Gtr London, England
    Posts
    222
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Data Input Form (2000 (9.0.4402 SR-1))

    Many thanks your reply and your priceless assistance! I have noted your points on design and will implement accordingly.

    I maybe trying to be too flash with the form I'm designing.

    My idea was to input directly to the temporary table with the main form and as the users appended the new record, then by way of requerying within the subform to show the new record added to the table along with the previous. So, data entry up top as it were and a rolling list of the new records entered listed below. I'm not sure if that makes sense or whether I've described my thoughts properly (I may have had too many Lagers last night)! Shall I resubmit the cut down DB with the changes below for your/other peoples perusal?

    I have taken out the lost focus items, repositioned the Afterupdate checks to BeforeUpdate along with adding the Cancel = True to the checks. Further, I have placed the "DoCmd.GoToRecord , , acNext" statement plus "Me.CONTRACTNO.SetFocus" into the AfterUpdate sub routine and this has solved the problem of blanking the input form (i.e. displaying the new record) and setting the focus to the first field. This seems to work ok now and I can move on to the next building phase.
    Cheers, <img src=/S/bravo.gif border=0 alt=bravo width=16 height=30>

    Niven

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Data Input Form (2000 (9.0.4402 SR-1))

    OK, I can see how you'd want to use the subform to display existing records. I would probably set the Tab Stop property of the subform control on the main form to No, so that users won't tab into it.

    If you have more questions (feel free to ask them!), you can repost the database, otherwise it's not really necessary.

  6. #6
    3 Star Lounger
    Join Date
    Nov 2003
    Location
    London, Gtr London, England
    Posts
    222
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Data Input Form (2000 (9.0.4402 SR-1))

    The lagers couldn't have had too bad an effect if you understood my ramblings!

    Yes! Good point with the Tab Stop, one further thing on the sub form, the background colour is grey and yet the first field in the first record is displayed as white. I can see this is where the cursor is positioned, but can't see how to get it to display as the background colour. I could turn off the enabled properties for all the records, but this displays the data in a light grey. I'm sure I've had this problem before, but can't think how to rectify it. Could you advise, please?

    Cheers again,

    Niven

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Data Input Form (2000 (9.0.4402 SR-1))

    Open the subform in design view.
    Select all controls in the Detail section.
    Change their Back Color property from -2147483643 (i.e. Window Background, usually white) to -2147483633 (i.e. Button Face, the same color as the detail section, usually gray).

  8. #8
    3 Star Lounger
    Join Date
    Nov 2003
    Location
    London, Gtr London, England
    Posts
    222
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Data Input Form (2000 (9.0.4402 SR-1))

    Yep! Worked fine, think I'm going number blind as I looked at that one and thought it was already the gray colour number!

    Cheers,

    Niven

  9. #9
    3 Star Lounger
    Join Date
    Nov 2003
    Location
    London, Gtr London, England
    Posts
    222
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Data Input Form (2000 (9.0.4402 SR-1))

    Hans.

    Sorry to come back so late on this one after so long, but the DB has been shelved for a while and it's only just occurred to me to look at it.

    I can't seem to find where you set the Tab Stop property of the subform control on the main form.

    Could you guide me please? Further, I am hoping this will deal with a problem I have where if I click on the subform, whilst entering data onto the main form, then the data gets posted to the temporary table and then displays said data in the sub form. Obviously what I would like here is that records can only be posted if a command button I have set up is clicked.

    Trust this makes sense,

    Niven

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Data Input Form (2000 (9.0.4402 SR-1))

    Open the main form in design view.
    Click ONCE on the subform (if you click a second time, you'll select something in the subform)
    The TabStop property is in the Other tab of the Properties window.

    You could set the Enabled property of the subform (again as a control on the main form) to No. That way, the user cannot click in the subform.

  11. #11
    3 Star Lounger
    Join Date
    Nov 2003
    Location
    London, Gtr London, England
    Posts
    222
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Data Input Form (2000 (9.0.4402 SR-1))

    Ah ha!

    I was clicking in the top left corner of the subform and viewing the properties from there. I must have had a big memory lapse from your earlier advice, because when I viewed the properties for the subform as you described, I'd already set the Tab Stop to No!

    Interesting scenario here though. I have routines to check that all the required fields are entered before the record can be added to the temporary table and have a command button for this purpose, however if I click on the subform, it performs the same routines as the command button and if the fields are complete will add the record to the temporary table. In one sense this isn't a problem, I could tell the users that when they've completed the input of the new record they have a choice of clicking the command button or just clicking on the subform, but in another, if they accidentally click on the subform whilst reviewing what they've input, the data that gets posted might be incorrect. I feel that I need to avoid this issue and tie them down to just the command buttons (I.e. I can't be held responsible for incorrect data once they've clicked to post it!).

    Would appreciate your thoughts on solving this.

    Cheers,

    Niven

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Data Input Form (2000 (9.0.4402 SR-1))

    You could set the Enabled property of the subform as a control on the main form to No in the On Current event of the main form. Each time the user moves to another record in the main form, this will make the subform non-clickable.
    Set the Enabled property of the subform to True in the On Click code of the command button if the main form record has passed all tests.

Posting Permissions

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