I assume you have placed the above code in the OK Button On Click Event, Does the event execute any other code prior to this loop, can you paste full code of the OK Button On Click events here
Thanks
I created a union query and tested it as a single form record source as well as for subform record source, It did not show any error message.
In your case there could be some complication in Union Query.
Alternatively you can create another query as follows
SELECT * INTO Temp FROM <<union...
The main form is having the same record source as that of subform.
Moreover your combobox control source is bound to actual field from the record source.
Just make the control source of the combobox as unbound and try
I have simulated your scenario, It worked for me.
Assuming You have trapped Divide by Zero Error
Case-1
Please go to design mode and cross-check the control name you have used for ATI, It should be same as what you specified in AVG() function.
Case-2
Alternatively, in Footer Average Control...
You have to make use of Nz() function. Nz function converts a Null value and prevent it from propagating through an expression.
In case there is no qty for a particular year then Nz function will return zero.
Example
x = Null
y = 5
z = x + y
msgbox z
'You will get "Invalid use of Null"
z...
Do you have any other lines of code associated with this event or any other event related the said last control?
If so, can you please paste those code related to last control along with the event.
There are easier ways to format zeros and decimals
Give numerical examples of initial price format
along with the final format that you wish to have
Give example on How you want the below like to look in terms of number
RemoveDecimal = Price & NewPrice
Possible test cases would be:
The field `[accepted services date]` must be present in the `additional Victim` table as spelt in the code.
A Textbox forms!client!acceptedservicesdate must be present in the `client` form as spelt in the code.
The data type of `victim` field has to be integer...
In your code paste the following code above the line Do While Me.NewRecord = False
DoCmd.RunCommand acCmdRecordsGoToFirst
ie.,
DoCmd.RunCommand acCmdRecordsGoToFirst
Do While Me.NewRecord = False
MsgBox Me.SampleID
If Me.chkResultsReceived Then
If strReturnedList = "" Then...
You can write a code for Afterupdate Event of the combo box as shown below to open another form...
Private Sub Combo0_AfterUpdate()
DoCmd.OpenForm "Company", , , "[Company ID] = " & Me.ActiveControl.Column(0)
End Sub
You can use "n" to calculate time difference in minutes when using DateDiff function. Example is shown below
Public Function calculate_time_difference()
starttime = #10:00:00 AM#
endtime = #10:35:00 AM#
MsgBox starttime & Chr(13) & endtime & Chr(13) & DateDiff("n", starttime...
Could be because the onCurrent event is refering to the main form, instead of subform. Make sure the onCurrent event is refering the subform field value.
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.