Ahhh! That makes perfect sense. I've been looking at this way toooooo long. Thanks for your help!
Ryan...
User Profile
Collapse
-
How can I use a global variable in a
I have multiple forms that all run the same sub routine. In each form, I simply call the standard module that contains the sub routine. My sub routine contains a variable which gathers the form name of the open form and also the userName value of each form, like this:
Code:Public userNameBC, frmName As String Public Sub Form_Load() Set frmCurrentForm = Screen.ActiveForm frmName = frmCurrentForm.Name
-
Hi Rabbit,
Thanks for your reply. The reason I can't use me. is because I have multiple forms that will use one function. I need a way to get the form name by using a variable.Leave a comment:
-
How can I use my current form name as a variable?
I have a form that runs a series of sub routines when it loads. In my subs, I want to use a variable which pulls the name of the current form that I'm loading. I have the following code, but I keep getting error 2475: "You entered and expression that requires a form to be the active window".
Code:Private Sub Form_Load() Dim frmCurrentForm As Form Set frmCurrentForm = Screen.ActiveForm
-
-
How do I make a function/sub so that I can run it from multiple forms?
I have a function in my database that I want to use in multiple forms. How can I set up my function so that I can just call it in each form? And how do I call it in my form code?
For example, here's a generic function:
Code:Public Function genericMessage() MsgBox "Here's my message" End Function
Code:Private
-
-
Hmm I can't get it to work. Maybe I'm not understanding what a "Standard Code Module" is. I create this by going to "Insert" and then "Module", correct?Leave a comment:
-
Hi ADezii,
Thank you for your response. Where do I insert the "Set userName = me.userName" declaration so that it is available globally as well?...Leave a comment:
-
ryaanmichael started a topic How do I assign an object reference once so I can use it in multiple subs?in AccessHow do I assign an object reference once so I can use it in multiple subs?
I have multiple events (click, afterupdate, etc) that perform different actions using the same object. How do I assign an object's reference only once so that I don't have to retype it for every sub or function. For example, the below code works, but I'm trying to avoid typing the "Set userName = me.userName" for every event. Isn't there a way to define it and use it for all subs? Here is a general script the shows what I mean.
... -
Twinnyfo,
Just wanted to say thank you and let you know the code works perfectly! Thanks again for your help!Leave a comment:
-
Thank you so much for your time! I am going to try this out and let you know how it goes.
Thanks again,
RyanLeave a comment:
-
Hi Twinnyfo,
Thank you so much for your continued assistance. I'm not understanding this recordset thing. At first it seemed like a really simple task. Anyways, here is my non-working code:
Code:Private Sub sentRPT_Click() Dim openTrip As Recordset ' "rptOpenTrip" references the Report I want to include in my Outlook email ' My report gathers data from my query "qryCurrentTrip" when the values
Leave a comment:
-
Hi Twinnyfo,
My report data is gathered from a query called "qryCurrentTrip ". All the information for the query is pulled from my table "tblCurrentTrip ". The query ("qryCurrentTri p") filters all the data in the "Name" field which is equal to "th98". The report shows only records with "th98" in the "Name" field (usually only about 5-10 records). The report contains...Leave a comment:
-
Hi Twinnyfo,
I've tried the recordset, but I can't get it to work. I've got a report called "TripCSA" that contains all the data I want to include. I want to take all that data and put it in my Outlook email body.
Thanks in advance,
RyanLeave a comment:
-
Send Access report in body of Outlook email
Is there a way to insert data/information from a report into the body of an Outlook email message?
I want the VBA code to pull the data from my report, input it into the body of my email message, and then send, without using any attachments.
Thanks for any assistance! -
Hi Twinnyfo,
Thanks for your help again. I still can't get this to work. I updated the code your provided with the names of my querys/field names, but its still now working. I'm not sure I understand the strSQL line. My current query (qryUniqueCUSTO MER) provides the unique customer names already, should this SQL line be different? Here's what I got right now:
Code:Private Sub NotifyAll_Click() On Error GoTo EH
Leave a comment:
-
Hi Twinnyfo,
Thanks for your reponse. Please forgive my ignorance, I'm not too experienced in VBA. How can I get my code to loop through the unique records and find all the records for the unique person?
I made a query that pull the the unique customer name, but how do I do the rest? Here is a simplified version of my current code that only pulls one record:
Code:Private Sub notifyCustomer_Click()
Leave a comment:
-
Hi Twinnyfo,
My e-mail code send emails in Microsoft Outlook. The "send" button in my database pulls the data from a single record, puts it in the body of an outlook email, then "displays" it so I can send it out. It works great for one record, but I would love for the code to pull all records for a single user, and place all that data in the body of an e-mail.
Thanks for your help!Leave a comment:
-
Find all records for a single customer and send them in e-mail
I have a table that contains customer records when they need an e-mail notification. The records only appear in the table when the customer needs a notification (this info is pulled from an HTML page). Sometimes there are multiple records for one customer because they need notification for multiple things. Right now I have a button that sends an email to the customer, but only for one record (its just a form that shows one record). What I want to...
No activity results to display
Show More
Leave a comment: