Have found many solutions on this forum to get to this point so finally registered.
I have a form which should load 17 forms. - Private Sub Form_Load()
-
On Error GoTo Err_Form_Load
-
DoCmd.Minimize
-
DoCmd.OpenForm "Reminder Lease Expiry 6mth", acNormal
-
DoCmd.OpenForm "Reminder Lease Expiry 2mth", acNormal
-
DoCmd.OpenForm "Reminder Renewal 6mth", acNormal
-
DoCmd.OpenForm "Reminder Renewal 2mth", acNormal
-
DoCmd.OpenForm "Reminder Landlord 6mth", acNormal
-
DoCmd.OpenForm "Reminder Landlord 2mth", acNormal
-
DoCmd.OpenForm "Reminder Tenant 6mth", acNormal
-
DoCmd.OpenForm "Reminder Tenant 2mth", acNormal
-
DoCmd.OpenForm "Reminder Misc 6mth", acNormal
-
DoCmd.OpenForm "Reminder Misc 2mth", acNormal
-
DoCmd.OpenForm "Reminder Rent Escalation", acNormal
-
DoCmd.OpenForm "Reminder Fixed Monthly", acNormal
-
DoCmd.OpenForm "Reminder Body Corporate Levy", acNormal
-
DoCmd.OpenForm "Reminder Rent Review", acNormal
-
DoCmd.OpenForm "Reminder Loan Term Expiry", acNormal
-
DoCmd.OpenForm "Reminder Loan Repayment", acNormal
-
Err_Form_Load:
-
If Err.Number = 2501 Then
-
DoCmd.Restore
-
End If
-
End Sub
The 17 reminder forms run from queries which show reminders past due or as at today's date. If query produces no record the forms close, or if there are due dates sendObject sends the form as an attachment in an email. - Private Sub Form_Open(Cancel As Integer)
-
On Error GoTo Err_Form_Open
-
If IsNull(Me.Tenant) Then
-
Cancel = True
-
Exit_Form_Open:
-
Exit Sub
-
Err_Form_Open:
-
If Err.Number = 2501 Then
-
Resume Exit_Form_Open
-
End If
-
Exit Sub
-
End If
-
End Sub
-
-
Private Sub Form_Load()
-
On Error GoTo Err_Form_Load
-
DoCmd.SendObject acSendForm, "Reminder Lease Expiry 6mth", acFormatRTF, _
-
"email; email; email; email", "email; email; email", "email", "Tenant Leases: Reminders", , True
-
Exit_Form_Load:
-
Exit Sub
-
Err_Form_Load:
-
If Err.Number = 2501 Then
-
Resume Exit_Form_Load
-
End If
-
End Sub
-
This works fine until reaches a form with 0 records which closes, and then it does not run through rest of forms. Any help? thanks.
4 3170
I've done something similar for my project - it might not be what you've been looking for, though. - Private Sub Form_Load()
-
Me.Visible = False
-
If DCount("*", "ExpiryQuery1") > 0 Then
-
DoCmd.OpenForm "ExpiryForm1", acFormDS, , , acFormReadOnly
-
-
Else
-
If DCount("*", "ExpiryQuery2") > 0 Then
-
DoCmd.OpenForm "Expiryform2", acFormDS, , , acFormReadOnly
-
-
Else
-
If DCount("*", "ExpiryQuery3") > 0 Then
-
DoCmd.OpenForm "ExpiryForm3", acFormDS, , , acFormReadOnly
-
-
Else
-
If DCount("*", "ExpiryQuery4") > 0 Then
-
DoCmd.OpenForm "ExpiryForm4", acFormDS, , , acFormReadOnly
-
-
Else
-
MsgBox "nothing has expired"
-
-
End If
-
End If
-
End If
-
End If
-
Me.Visible = True
-
End Sub
and then in ExpiryForm1: - Private Sub Form_Close()
-
If DCount("*", "ExpiryQuery2") > 0 Then
-
DoCmd.OpenForm "Expiryform2", acFormDS, , , acFormReadOnly
-
-
Else
-
If DCount("*", "ExpiryQuery3") > 0 Then
-
DoCmd.OpenForm "ExpiryForm3", acFormDS, , , acFormReadOnly
-
-
Else
-
If DCount("*", "ExpiryQuery4") > 0 Then
-
DoCmd.OpenForm "ExpiryForm4", acFormDS, , , acFormReadOnly
-
-
Else
-
MsgBox "nothing has expired"
-
-
End If
-
End If
-
End If
-
End Sub
and so forth for the form_close event of forms 2 and 3, so that the forms run in a cycle, and any with no results gets bypassed. The advantage of this is that you're not opening all the forms at once, but if you did want to, I would imagine the code would look something like this: - Private Sub Form_Load()
-
-
If DCount("*", "ExpiryQuery1") > 0 Then
-
DoCmd.OpenForm "ExpiryForm1", acFormDS, , , acFormReadOnly
-
If DCount("*", "ExpiryQuery2") > 0 Then
-
DoCmd.OpenForm "Expiryform2", acFormDS, , , acFormReadOnly
-
If DCount("*", "ExpiryQuery3") > 0 Then
-
DoCmd.OpenForm "ExpiryForm3", acFormDS, , , acFormReadOnly
-
If DCount("*", "ExpiryQuery4") > 0 Then
-
DoCmd.OpenForm "ExpiryForm4", acFormDS, , , acFormReadOnly
-
End If
-
End If
-
End If
-
End If
-
End Sub
As you can see, I'm opening the forms as datasheets and read-only, that might not be what you're after.
I'm not so hot with access so feel free to take this with a pinch of salt, but it's something I've just had to do as well.
Thanks pelicanstuff for prompt response.
Just doesn't want to work though - stops short each time after first two forms.
Thanks pelicanstuff for your prompt response, but I still cant get this to work. I've tried re-arranging the opening order of the Expiry form DoCmds in the main form code, to see where it hangs, and I think it has to do with the Exit or Error handler on the SendObject email sender in the Reminder form code: - Private Sub Form_Load()
-
On Error GoTo Err_Form_Load
-
DoCmd.SendObject acSendForm, "Reminder Body Corp Levy", acFormatRTF, _
-
"email; email; email; email", "email; email; email", "email", "Tenant Leases: Reminders", , True
-
Exit_Form_Load:
-
Exit Sub
-
Err_Form_Load:
-
If Err.Number = 2501 Then
-
Resume Exit_Form_Load
-
End If
-
End Sub
Any ideas how I should change this? (Access 2003) Thanks.
I take it back! Thanks! It works! Maybe took a while to get right because 17 different reminders! Thanks again.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Steve Jorgensen |
last post by:
In a recent thread, RKC (correctly, I believe), took issue with my use of
multiple parameters in a Property Let procedure to pass dimensional
arguments on the basis that, although it works, it's not obvious how the
code works if you don't know the intricacies of the Property Let/Get
syntax. Likewise, I dislike (and code to minimize the use of) the VB/VBA
syntax of returning a value by referring to the function name as if it were
a...
|
by: stumorgan |
last post by:
There is probably an extremely simple answer to this question and I'm
just being foolish.
I have a main form (let's say FormMain) which opens other forms (let's
say Form1, Form2). How do I keep those created forms, Form1 and Form2,
from closing when I close FormMain? Right now what I'm doing is
threading them by wrapping the Show method and in that threaded wrapper
I have a while loop that just does Application.DoEvents() as long as...
|
by: Academic |
last post by:
I have a MDI form, sometimes child forms and sometimes forms that are
neither
If I close the app the child forms closing and closed event happens followed
by the Mdi form receiving the events..
But the regular forms that are also open do not receive that event. This is
true whether there are child forms open or not.
|
by: robert.waters |
last post by:
Hello,
I have a main form that is maximized when my application loads; this
main form contains links to all other forms. I've had to specify the
Popup property of these other forms, so that they are not maximized
when they load. Unfortunately, this seems to have had the consequence
of removing them from the Windows taskbar, which makes navigating
between open forms more difficult.
How would you developers deal with navigation between...
|
by: Bob Alston |
last post by:
Looking for someone with experience building apps with multiple
instances of forms open. I am building an app for a nonprofit
organizations case workers. They provide services to the elderly.
so far I have built a traditional app, switchboard, forms, etc.
Part of this app is to automate the forms they previously prepared
manually.
After the app was built and works just fine, I find out there are
several case managers using MS word...
| |
by: robert.waters |
last post by:
Do you have your users rely on the windows taskbar to manage/navigate
between the forms they have open, or do you provide another (more
robust) method? Does anyone use a custom navigation system (like
keeping a selectable list of open forms in a listbox/commandbar/
breadcrumb trail etc.)?
|
by: waynetheengineer |
last post by:
Hi,
I'm trying to write code for a form when it closes. It's supposed to requery a combo box depending on which form is currenlty open in the background behind the current form, shown below:
Private Sub Form_Close()
If Forms(frmProjecTotal).CurrentView <> 0 Then
Forms!!.Requery
Else
Forms!!.Requery
|
by: =?Utf-8?B?R3JlZw==?= |
last post by:
How can I tell via code if a Form is already open.
Each time my forms load I have some initialization code that runs, but if
the form is already open and hidden I don't want that initialization code to
run. Thus, I just want to unhide the form.
My thought is eveyrtime I go to load a form I could scan through all the
open forms in my project and determine whether the one I'm getting ready to
load is open or not.
|
by: nottarealaddress |
last post by:
I'm trying to get my feet wet in VB2005 (our new standard at work
after officially stopping new development in VB6 about a month ago).
I'm working with a simple sql 2005 table of 50 entries, one for each
state. Each entry contains Name, postal abbreviation, etc. Just simple
stuff to understand the mechanisms, syntax, etc.
I'm now to the point where I've got a Master MDI form that opens one
or more types of forms, I'm able to edit/save...
|
by: vanlanjl |
last post by:
Okay lets see if I can do this with out confusing myself or others. First I will give ALL the details then state my problem and request at the bottom.
Tables:
tblContacts
ID
Company
LastName
FirstName
Initial
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |