Modules & VBA :: Adding Text To Label Caption On Timer
Jan 20, 2015
I have globally defined 'Progress' as integerer and using the following code on my splash screen - i want to add a "." to the end of the label caption until progress = 10 (10 timer events)
Private Sub Form_Load()
Progress = 0
End Sub
Code:
Private Sub Form_Timer()
Dim Dot As String
Dot = "."
Progress = Progress + 1
Me.lblProgress.Caption
If Progress = 10 Then
DoCmd.OpenForm "frmLogin"
DoCmd.Close acForm, "frmSplash"
End If
End Sub
I have a text box in a form, in which users enter updates. I would like that text to become the caption on a label in a printable report. How would I write the VBA to do this?
On a form I have multiple labels. In the Click event of all these labels I would like to call a generic function for futher processing. For this processing however, I need the caption of the label the user clicked on. How do I determine this caption?
This code works well and frmRepair opens with the updated label caption. The original value was "Return/repair Information"
A few other things need to change on frmRepair depending on this caption as well as the values of some other fields, so I use the following code in the onload event (although I later tried the onopen even)
Code: 'Disable labels button if there is no RMA and the item is a repair MsgBox Me.lblmain.Caption If Me.lblmain.Caption = "Return/Repair Information" Then Me.txtRMA.SetFocus MsgBox Me.txtRMA.Text
[Code] ....
However, I cannot get this to work as the "if" statement always returns "Return/Repair information" and not the modified caption. The message box confirms that this is the case.
I suspect that this has to do with the point in time that the frmRepair loads or opens and when my code enters the modified values.
I tried this but dont know how to stop the timer...I want to run the code that changes the Form color but want to be able to stop the Timer and reset it to start over..Will this timer work? Almost like an auction timer. But want to be able to reset the code at any stage...
Code: Public Sub ExcelTimer() Dim PauseTime, Start, Finish
I'm trying to customise the error message for Input Mask Violations, so that it references the control where the error has occured, rather than just being a generic error message.
I can make this work using the code below:
Private Sub Form_Error(DataErr As Integer, Response As Integer) Const INPUTMASK_VIOLATION = 2279 If DataErr = INPUTMASK_VIOLATION Then MsgBox "Please check that the information you have added in the " + Screen.ActiveControl.Name + " field is in the appropriate format." Response = acDataErrContinue End If End Sub
BUT, all my field names are shortened e.g. Mobile Number = MobileNo, so I want to use the caption property instead. I assumed I could just change it to "Screen.ActiveControl.Caption". But this doesn't work at all!
I have copied a VBA from the net and it is working fine and producing my report on outlook body text but one problem me facing is that it is pasting only first page if the second page is there it is not coming in outlook text body this what i want rest every thing is correct the code is:
Private Sub Command88_Click() Const ForReading = 1, ForWriting = 2, ForAppending = 3 Dim fs, f Dim RTFBody, strTo Dim MyApp As New Outlook.Application Dim MyItem As Outlook.MailItem
Ok, I've run into two serious problems in testing, and another question that I'm hoping you guys can help me solve. Below my questions is the code used for making the search query/email program.
Problem #1: In testing, this search program only is working for me for new data. Any data that I had in the database prior to implimenting the program will not move past the search stage. In other words, I will do a search, it will find the emails and bring them up in a box, I hit "OK" and it gets hung up and won't move on to opening up a new Email with the addresses implemented. However if I enter new data in the database, say with a weird name so its only bringing up the new entry and no old entry, it works fine and opens up the new email.
Problem #2: Items I would like to search like check boxes. Say I have a check box "Donor", this is listed in the database as a 1 or 0. I can't have my boss searching 1 or 0. Is there a way to change this to, say, being recorded in the DB as a Yes or No. That way he would check to search "Donor" and type Yes in the search box and this would search the DB "Donor" column for "Yes" and bring up the results.
New Question: My boss and I reviewed the form as it is so far yesterday. He was asking if I could add a Print Labels option in there. I'm wondering instead of adding another seperate search box and all that mess for a labels search print, can I rather add two check boxes, one labeled "Print Labels" and the other labeled "Email". What this would do is depending on the check box you selected it would either run the search and email like we have it, or clicking the other check box would run the search and print labels.
Quote: 'Author: Michael Walts, but use it as you like'Important information! this code requires a reference to the Microsoft DAO object library Option Compare Database Option Explicit
Private Sub cmdEmail_Click()
'will hold the dynamic SQL query Dim strSQL As String
'will hold the WHERE clause portion of our SQL query Dim strWHERE As String
'will hold all the recipients of this message Dim strRecipients As String
'the recordset we will use to get the emails of the records that match our criteria Dim rst As DAO.Recordset
'if there is input in the search criteria, then we will run the query and send the e-mail If txtSearch <> "" Then
'if you have more buttons, just add mosr cases (the value of the radio button '= the Case number, so Value of the State radio button is 1, etc.) Select Case opgSearch.Value
Case 1 strWHERE = "WHERE State = '" & txtSearch & "'"
Case 2 strWHERE = "WHERE City = '" & txtSearch & "'" End Select
strSQL = "SELECT EMail FROM tblUser " & strWHERE
'run the query and get the results into the recordset Set rst = CurrentDb.OpenRecordset(strSQL)
'Loop through the recordset and add all the EMails Do While Not rst.EOF strRecipients = strRecipients & ";" & rst!EMail rst.MoveNext Loop
'remove the first ; from the strRecipients strRecipients = Right(strRecipients, Len(strRecipients) - 1)
'stops a ' entered in the field from breaking the query Private Function SQLSafe(safeMe As String) As String SQLSafe = Replace(safeMe, "'", "''") End Function
Is there a way to make the text in a label smaller than size 8? I need to put some text on a form, but it's too large for the limited amount of space I have.
I have a text label that I would like to have vertical instead of horizontal. In the properties box, I go to the other tab and set 'Vertical' to yes and the text rotates. Except it rotates 90 degrees clockwise. (The text starts at the upper right corner and reads down, you have to tilt your head to the right to read it.) This seems the wrong direction to me and to my office mate - all the tables we've seen with vertical text has the text rotated 90 degrees counterclockwise (text starting from the lower left corner and reads up, you have to tilt you head to the left to read it.)
Is there any way I can make the text rotate counterclockwise instead of clockwise? I really don't want to create many little graphics.
Does anyone know how to create a text box inside of a label box in a report? I need to create a report that mirrors a memo format. In the report, I need to type a label ("Total score is __ out of __.") where the __ spaces are calculatedtext boxes based on a table. Thanks.
I have one field in my table "Id". Here I have inputed 16 digit number always. Can I print out every digit with different text box or label in my report?
I have a Menu form that has 5 cmdbuttons that opens the same main forms but with 5 different filters. I want a label or text box to change to the name of the filter. I am using VBA to open the form. I can't code a form that's not open yet. Is there any way to accomplished the above?
I'm running Access 2003 and my question relates to delivery notes that are produced for drivers as reports. These delivery notes have a blank payment box for the driver to complete if the customer pays upon delivery.
As more and more customers are prepaying by credit cards, I'd like this payment box to be automatically filled with a "PAID" text which will let the driver know the order has already been paid for.
The delivery note is produced from an "Orders" table which has a "Paid" field whose value is automatically set to "Yes" when the order has been paid for.
I was hoping to be able to place a "PAID" label on the report which is only visible when the Paid field of the underlying query is Yes.
As things are at the moment I cannot see any way to put any conditional statement onto this Text/Label. The only options for the "Is Visible" property of the text are Yes or No.
I have a report that displays on a continuous style report. What courses the employee have been on and when they expire
right I have field call expirydate and another call dayover showing the number of days till that course has expired also I have made a label called Expired1
now what I'm trying to do.....
if the expirydate has passed I want the expired1 label to be visible and dayover field to become invisible
I have tried
Code: Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) If Me.Expirydate < Date Then Me.expired1.Visible = True Me.DaysOver.Visible = False End If If Me.Expirydate > Date Then Me.expired1.Value = False Me.DaysOver.Value = True End If
I have also tried the code on current event on the report
now my problem if one of the course has expired it will show the label called Expired1 but on all the records but I only want it to display on the record that has expired and leave the daysover text box visible if course has not expired