By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,139 Members | 1,228 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,139 IT Pros & Developers. It's quick & easy.

Requery skip to a New Entry ?

100+
P: 134
I have an Invoice form that consist of main form and a sub form.
Main form consist of customer address and contact...etc

Sub form is a continue form for item purchase.
I have an unbound field - txtfreight, every time I enter an amount into the txtfreight, this Problem drive me nut -

In the Afterupdate event on line 1 and line 2, I am trying to update the
unbound txtfreight onto the field "freight", (1) but it never write or update to
the field - freight ?

So I need to trigger the requery on line 7, this time it write or update the
field -freight, (2) but the entire form become blank, because it skip to a new
form entry ? I have set the form property - Data Entry = No.

Does anyone know what the problem with the coding



Private Sub txtfreight_AfterUpdate()

1. Forms.frmctmletter.freight = Forms.frmctmletter.frmCtmLines.Form.txtFreight
2. DoCmd.RunCommand acCmdSaveRecord
3.
4.
5.
6. If Me.txtamt > 0 Then
7. Forms.frmctmletter.Requery
8. End If
Jan 3 '08 #1
Share this Question
Share on Google+
2 Replies


puppydogbuddy
Expert 100+
P: 1,923
I have an Invoice form that consist of main form and a sub form.
Main form consist of customer address and contact...etc

Sub form is a continue form for item purchase.
I have an unbound field - txtfreight, every time I enter an amount into the txtfreight, this Problem drive me nut -

In the Afterupdate event on line 1 and line 2, I am trying to update the
unbound txtfreight onto the field "freight", (1) but it never write or update to
the field - freight ?

So I need to trigger the requery on line 7, this time it write or update the
field -freight, (2) but the entire form become blank, because it skip to a new
form entry ? I have set the form property - Data Entry = No.

Does anyone know what the problem with the coding



Private Sub txtfreight_AfterUpdate()

1. Forms.frmctmletter.freight = Forms.frmctmletter.frmCtmLines.Form.txtFreight
2. DoCmd.RunCommand acCmdSaveRecord
3.
4.
5.
6. If Me.txtamt > 0 Then
7. Forms.frmctmletter.Requery
8. End If

Three things:
1. if txtfreight is calculated rather then entered, the afterUpdate event will never fire. So if txtFreight is calculated, place your code in the Form_BeforeUpdate event of your subform.
2. Forms!frmctmletter!freight.Value = Forms!frmctmletter!frmCtmLines.Form!txtFreight
3. Change "requery" to "recalc". Requery does change the record pointer.
Jan 3 '08 #2

100+
P: 134
Three things:
1. if txtfreight is calculated rather then entered, the afterUpdate event will never fire. So if txtFreight is calculated, place your code in the Form_BeforeUpdate event of your subform.
2. Forms!frmctmletter!freight.Value = Forms!frmctmletter!frmCtmLines.Form!txtFreight
3. Change "requery" to "recalc". Requery does change the record pointer.
Wow ! It works to what I expect, I don't even know a command "recalc", thank you so much Master !!! ....You are powerful ! And you light up my life.
Jan 3 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.