If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#12
|
|||
|
|||
Add record Problems
Craig,
I would imagine the After Update event of the subform would be the way to go. And you need Recalc not Requery. Since the control you want to update the display of is on the main form, I guess it would be... Me.Parent.Recalc By the way, as an aside, 'date' is a Reserved Word (i.e. has a special meaning) in Acces, and as such should not be used as the name of a field or control. -- Steve Schapel, Microsoft Access MVP Craig M. Bobchin wrote: Thanks Steve, I tend to agree with you. What I finally wound up doing was this (and you will probably laugh): I recreated the form from scratch. Using just basic access functionality and not worying about trying to make the form do double duty. I'll create a separate admin form and menu button to handle that. It is much cleaner and works like a charm. Now if I could just figure out this damn running total isse I'm having. I need to create a daily running total of hours from the subform on the main form. So far so good. I use the Dsum and it updates the hours correctly. But only after I close the form. I'm trying to put a requery for the running totals fields someplace in the subform so it performs a requery after the hours are entered. I can get that part too but the problem is it then prevents me from adding records to the subform (which is in Datasheet view). The fields on the subform are in this order ResourceID, WeekID (both Hidden) Date, ProjectID, PhaseID, Hours and Comments. I've tried the following events with no luck Hours_afterUpdate event, Comments_exit, Form Current (logically where it should be but it prevents me adding new lines/records to the subform), Date_beforeupdate, Date_enter, Date_Exit and a few others. Any ideas what event I should put the requery into? |
#13
|
|||
|
|||
Add record Problems
Steve,
Thanks, The recalc worked, but with one strange side effect.... When leaving the last column on the subform, instead of adding a new line/record it jumps back to the 1st line/record in the subform data sheet. I had to add a DoCmd.GoToRecord , , acNewRec after the recalc to get it to work, but all is fine now. Thanks again for all your help. In article , says... Craig, I would imagine the After Update event of the subform would be the way to go. And you need Recalc not Requery. Since the control you want to update the display of is on the main form, I guess it would be... Me.Parent.Recalc By the way, as an aside, 'date' is a Reserved Word (i.e. has a special meaning) in Acces, and as such should not be used as the name of a field or control. -- You have no right to protection against being offended. |
#14
|
|||
|
|||
Add record Problems
Craig,
You haven't still got a Requery code in there, have you, on the subform's After Update event, or the After Update or Exit or some such event of the last control on the subform? -- Steve Schapel, Microsoft Access MVP Craig M. Bobchin wrote: Steve, Thanks, The recalc worked, but with one strange side effect.... When leaving the last column on the subform, instead of adding a new line/record it jumps back to the 1st line/record in the subform data sheet. I had to add a DoCmd.GoToRecord , , acNewRec after the recalc to get it to work, but all is fine now. Thanks again for all your help. |
#15
|
|||
|
|||
Add record Problems
Nope, the only code on the subform is the following: And yes I do know I
have to change the Date field's name Option Compare Database Option Explicit Private Sub Date_BeforeUpdate(Cancel As Integer) 'if the user enters a date that is more than 7 days less that the weekending date 'display an error and set the focus back 'to the date field. Dim intDays As Integer Dim dtDateEntered As Date Dim dtWeekEnding As Date dtDateEntered = Me.Date dtWeekEnding = Forms!tbltimetrack!txtWeekEnding If dtDateEntered = dtWeekEnding Then intDays = DateDiff("d", dtDateEntered, dtWeekEnding) If intDays 6 Then MsgBox "The date is not valid. Please re-enter a valid date for the week-ending: " & dtWeekEnding Cancel = True End If Else MsgBox "Date is not Valid." Cancel = True End If End Sub Private Sub Form_AfterUpdate() Me.Parent.Recalc DoCmd.GoToRecord , , acNewRec End Sub In article , says... Craig, You haven't still got a Requery code in there, have you, on the subform's After Update event, or the After Update or Exit or some such event of the last control on the subform? -- You have no right to protection against being offended. |
#16
|
|||
|
|||
Add record Problems
Craig,
Ok, well I wouldn't have expected that behaviour with the subfrom, but anyway, you've got it sorted so no point in sweating over that one! :-) Best wishes for the rest of the project. -- Steve Schapel, Microsoft Access MVP Craig M. Bobchin wrote: Nope, the only code on the subform is the following: And yes I do know I have to change the Date field's name |
|
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Creating a New Record in Sub Form_Current | Peter Hallett | Using Forms | 6 | January 27th, 2006 03:03 PM |
Last (blank) record on form will not delete! | [email protected] | General Discussion | 2 | December 16th, 2005 06:16 PM |
Creating Records in tables automatically | peterg290935 | Using Forms | 8 | June 22nd, 2005 08:12 AM |
strategy for data entry in multiple tables | LAF | Using Forms | 18 | April 25th, 2005 04:04 AM |
Problems Deleting a record. | Kris L. | Using Forms | 1 | July 15th, 2004 03:06 AM |