473,402 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

IIf Function based on field value of continuous form

I am trying to use a button with the vba coding for SendObject Function
to email a specific report based on the value of another field of the
current record.

The form is a continuous form and the values are either of the field
[IACUC/IBC] are "IACUC" or "IBC". If the value is IACUC, I want the
IACUC report to send, if IBC the IBC report to send. The email button
is located on the continous form details with the record specified and
report is filtered based on the registration form ID number.

I have written the SendObject commands into separate funtions and then
written an IIF function into the button click, but it only pulls up the
IBC report no matter what the value of the IACUC/IBC field. It seems
like I am possibly missing hte current record command? Any
suggestions?
All Code is below.
Private Sub cmdEmail_Click()
On Error GoTo Err_cmdEmail_Click

Dim stDocName As String

IIf CurrentRecord([IACUC/IBC].Value) = "IBC", IBCMail(), IACUCMail()
Exit_cmdEmail_Click:
Exit Sub

Err_cmdEmail_Click:
MsgBox Err.Description
Resume Exit_cmdEmail_Click

End Sub
Function IBCMail()
Me.Email_Sent_.Value = 1

stDocName = "Form C"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
'Open current report in preview
DoCmd.OpenReport stDocName, acPreview, "", "[Assigned
Number]=[Forms]![Personnel Form2]![registrations
list]![RegistrationForm ID]"

DoCmd.SendObject acReport, stDocName, "SnapshotFormat",
[Forms]![Personnel Form2]![registrations list]![Email1], , , "Current
IBC Form C", "Please find attached FORM C's listing currently approved
personnel"

End Function

Function IACUCMail()
Me.Email_Sent_.Value = 1

stDocName = "Request for IACUC Approval of Change Report"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
'Open current report in preview
DoCmd.OpenReport stDocName, acPreview, "", "[Protocol
Number]=[Forms]![Personnel Form2]![registrations
list]![RegistrationForm ID]"

DoCmd.SendObject acReport, stDocName, "SnapshotFormat",
[Forms]![Personnel Form2]![registrations list]![Email1], , , "Current
IBC Form C", "Please find attached IACUC Protocols Report listing
currently approved personnel"

End Function

Nov 13 '05 #1
2 3229
Okay... I figured out how to do the first part ... but now I am trying
to update multiple checkboxes on the continuous subform when I click a
button on the main form, but I can only get it to update the first
record. How do I get it to update all the records in the subform that
meet certain criteria?

Basically I am giving the user the option to send a main with only one
registration or send a mail with all of the departments registrations.
I got the checkbox to check that the report has been mailed one at a
time from the subform. But if they mail all of the registrtaions from
that department via the main form, I can not get it to chekc the mailed
report checkbox for all of those records in the subform.

Nov 13 '05 #2
use an update query on the subform's rowsource?

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
4
by: Bob Alston | last post by:
I have some dates which show in a continuous form, multiple rows at a time. I would like to color the background yellow, or the text yellow or some color other than black that would stand out,...
1
by: jimfortune | last post by:
From: http://groups-beta.google.com/group/comp.databases.ms-access/msg/769e67e3d0f97a90?hl=en& Errata: 19 solar years = 2939.6018 days should be 19 solar years = 6939.6018 days Easter...
4
by: dhowell | last post by:
I have a form with a continuous subform . subform has a combo box called . The following code is opening up the form, but is not applying the "Where" clause which is based on the combo box...
5
by: James | last post by:
I have a Continuous form in Access 2000. The form contains a date field and the user has requested( demanded nicely) that they want the date field to be yellow if there is no data in the field....
4
by: Susan Bricker | last post by:
I have a form that displays record information in Continuous Record display (scrollable list). One of the fields in the record is an Integer value called "rcode" (reason code). But, I don't want...
2
by: DeanL | last post by:
Hi guys, I'm using a subform to display a list of values from a single table. The form is showing the values in "continuous forms" view and there will only ever be two different values for the...
2
by: ramprat | last post by:
Hi Everyone, I have been going crazy trying to figure this out and I'm sure it's easy. I have a continuous form based on a table. Once someone enters a new record on the form I have code in the...
2
by: csolomon | last post by:
Hello: I am creating a form that will calculate a value based on the value selected from a case statement in a function. The function I created is called GetYield and accepts 3 arguments. I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.