Caption Property & Queries

How can I change the name of a Field in a query when the Caption Property has been set for the field in the underlying table? For example, table tblTest has a field named "Company Number". The Caption Property for this field has been set to "CompanyNbr". I want to create a query on this table and change the name of the field to "Co". I've tried "Co: [Company Number]", but the field name in the query is "CompanyNbr". I've tried "Co: [CompanyNbr]", but that results in a "Enter Parameter Value" dialog box for "CompanyNbr".

I realize I could simply delete the Caption. However, this is a database I receive weekly from an external source, and it has many fields in it.

This problem occurs in both Access 2003 &amp

Sponsored Links:

Related Topics

Changing the Caption Property of a Query Tab ?
When I create forms, I often use the naming convention frmNameOfForm.
Then I will change the caption property of the form so that the tab of the form does NOT show frmNameOfForm. I replace it with something more user friendly.

I'd like to do the same for my queries.

Is it possible to change the caption property of the query so that it does not show qryNameOfQuery on the tab

Caption -- change using VBA
Can you change the Caption property of a form while opening the form from another form? I know Me.Caption works.

I am trying:

but get this error message:
Error Number: 2465

Record Count Caption & Stopping Next Record If Blank
would be a life saver.

Why is this caption record counter not working?

Me.Caption = "Record " & (Me.RecordsetClone.AbsolutePosition + 2) & " of " & Me.RecordsetClone.RecordCount

and how can I stop my code from clicking onto the next record when I have this on click of my "Next" button?

DoCmd.GoToRecord , , acNext.

Dynamic Datasheet Caption
I have a form with a datasheet. I can change the field names of the datasheet by changing the "Datasheet Caption" property on the property sheet. However, it seems that I can only have a static name for the field. Is there a way to have the Datasheet Caption be dynamic?

Modifying Label Caption in VBA Code from Form?
I have a form that opens a report, and before I open that report I'm trying to change the caption of a label on the report. I'm having troubles accomplishing this. The label is named lblFilter, I've tried.

Report_MyReport.Controls("lblFilter").Caption = txtDate.value
Report_MyReport.lblFilter.Caption = txtDate.value

And, it just not working. I'm not sure how to reference that label's caption property properly.

Adding reports to a combo box - caption not working.
I'm trying to add a bunch of reports to a combo box. Here's the code:

Dim varReport As Variant
With CurrentProject
For Each varReport In .AllReports
If Right(varReport.Name, 1) = "Z" Then
cmbReport.AddItem varReport.Name
End If
Next varReport
End With

Problem is that the report names are not very end user friendly, and won't really be. I'm looking for a way to add the report's Caption to the combo as well, and tried using a 2 column combo and the following:

cmbReport.AddItem varReport.Name & ";" & varReport.Caption

This doesn't work though as I get an object doesn't support this property or method error.

How do i update and save the caption for a label?
I have a single form with a label.
Sometimes the user wants to update the caption for the label - this carries through to the report heading etc.

It's simple to get the user to change the caption using a button /InputBox, however when we close and re-open the Database
it defaults back to the original caption - not the updated one.
Is it possible to save the most recent caption as the default

Scolling Text
Can someone please look at this code for me. I got this code of another forum (forgot the user's name so unable to reference) but all I am trying to do is get text to scroll from left to right in smooth transition.

The below code works

Private Sub cmdscroll_Click() Dim x As Integer, y As Integer Dim Start, delay For x = 1 To 100 Start = Timer delay = Start + 1 Do While Timer < delay lbl1.Caption = Mid(lbl1.Caption, 2) & Left(lbl1.Caption, 1) lbl2.Caption = Mid(lbl2.Caption, 2) & Left(lbl2.Caption, 1) DoEvents Loop DoEvents Start = Timer delay = Start + 1 Next x End Sub

but it makes the text scroll too fast. The answer he had was to increase the delay time ie

delay = start+3000

. I have tried that to no avail.

My form has a command button as you can see from the code and 2 label boxes. The cmd button should start the scroll once clicked

Reserved Error 2950
Just created a report and had the following code:

Private Sub Report_Activate() TxtPurchaseOrder.Visible = True TxtPurchaseOrder.SetFocus Label17.Caption = "Thank you for your purchase order " & TxtPurchaseOrder.Text & " received " TxtDate.Visible = True TxtDate.SetFocus TxtPurchaseOrder.Visible = False Label17.Caption = Label17.Caption & TxtDate.Text & "." Text28.SetFocus TxtDate.Visible = False End Sub

Worked perfectly now i've introduced a subreport and it errors out on the second line, TxtPurchaseOrder.SetFocus giving the error stated earlier. TxtPurchaseOrder is a bound field linking to a table, the subreport is bound to a query.

.label.caption not repainting
Using Access 2007 and trying to change a label's Caption at runtime (OnCurrent event of a form). I did DoEvents, I did Me.Repaint, but the **** label displays the same caption.

(the same is True with a command button, it changes is Caption only when I click on it)

Still, the form goes in AllowEdits and AllowDeletitions. It behaves like an event is not raised.

Here's te code:

Button Caption
I have a form frmPettyCash and on the form are 3 buttons Cmd1, Cmd2 and Cmd3 which open the spending reports for 3 employees. There is a table tblEmployees with fields EmployeeID and EmployeeName with the 3 employee names. What I would like to do is link the EmployeeNames to the button caption ie Employee 1 to Cmd1.Caption, Employee2 to Cmd2.Caption etc. so that in the future if I change an employee name in the employee table the caption on the corresponding button will change also.

form captions
I was wondering if it is possible to assign this to a form caption forms!frmEmployee.comNumber. Like this

"Employees with more than " & forms!frmEmployee.comNumber & " point(s)"

Or something like that.

Failing that is there a way to set a query caption

useful tip: ALT + shortcuts
I discovered this from a template I downloaded for a completely separate reason.

Basically, in the caption of the button, place an ampersand ( & ) in front of the letter you want to short cut on your form,

for example: a caption of &Next, will display a button with the word Next, but the N will be underlined, meaning if you pressed ALT + 'N' it will perform the actions of the buttons.

It works with any letter of the word, N&ext will make the 'e' a short cut letter.

It's proved to be a very useful short cut tool, I hope it helps you all too.

Stuck on a VBA code, keeping asking me to debug
When I compile it shows no errors but once I close and go back to form view, it shows a run time error 424, object required and give me the option to debug.

Create a procedure for the frmMemberInfo form to do the following: a. Display the word Current to the right of the MemberID text box in bold, magenta text only when the MembershipStatus field value is Active.

Otherwise, display the word Review in bold, blue text. ( Hint: Remove all controls from the control lay-out before resizing the MemberID text box and adding the label for the message.

Use the Caption property in your VBA code, and make sure you enclose Caption property settings in quotation marks.)

Labeling command buttons
I am trying to apply the caption property to a series of command buttons each based upon a field that I get from a recordset generated from a query. So hypothetically my 30+ command buttons would have names like "EFF-01, EFF-02, EFF-03.

etc. sometimes. Button one would have the caption of EFF-01, button two would have the caption of EFF-02, . etc. The names would change per results from a query. All buttons would then have captions.

The form that I am trying to make is to simulate a touchscreen except for now with a mouse cursor. I am not able to assign a caption to my buttons. I have made my button names like cmd_Product_1, cmd_Product_2, etc.

In trying to reference my command buttons to assign the captions from my recordset info I made a string variable for cmd_Product_ and an integer variable to append to the end of the name. I believe the variable string name for my command buttons is working OK up until it comes time for me to assign the string to the control. I get a runtime error 91 "object variable notset".

OnCurrent Event not firing when using Split Form
I have a form that contains a tab control. I want the tab control caption to include the number of records in the datasheet within that tab. I coded this in the OnCurrent property on the form, so that the "dynamic caption" changes based on the current record on the main form. This all works.

The problem is.If a type in the record number in the record selector or navigate with the record selector arrows, the dynamic caption reflects the current record count, etc. and it all works. But if I navigate to the record with the Split Form, the dynamic caption doesn't change. I thought the OnCurrent event always fires when you change records, but it apparantly isn't working when navigating with a split form. Anybody know of a workaround

Set Label.Caption to field of recordsource
My form is bound to a tabel by assigning the table name to the RecordSource property of the form.
How can I set the caption of a label to show the value of the field of this recordsource?
There's a field Description in the recordsource, I want the label to contain the value of this field.
How can I do this using VBA

IsNull not catching all nulls
I have a field in Event table called EventAttachment. EventAttachment is an Attachment datatype. I want the code to see if it is null and if so put No Attachment in the caption. Sometimes it works and sometimes it doesnt. For instance, Record 455 has no attachments but it displaying Attachment.

Below is the code:

If IsNull(DLookup("EventAttachment", "Event", "CompanyID = " & Me!txtCompanyID)) Then
Me!cmdAttachments.Caption = "No Attachment"
Me!cmdAttachments.ForeColor = vbRed
Me!cmdAttachments.Caption = "Attachment"
Me!cmdAttachments.ForeColor = -2147483615
End If

Does anyone see anything wrong with the

Timer Event - Why does this happen
I'm attempting to display that my database is working through the following code in the form_timer() event:

Private Sub Form_Timer() If working.Caption = "working" Then
working.Caption = "working." Else
If working.Caption = "working." Then
working.Caption = "working."
If working.Caption = "working." Then
working.Caption = "working."
working.Caption = "working"
End If
End If End If End Sub

This works okay if the database isn't taking any actions. Once the database begins work, the label disappears. I use a macro to make the label visible and call the timer event. I then call the working event. I then call a function that hides the caption. The working event isn't a quick process, it can take about 5 minutes to compete. It basically opens 2 Excel files, runs a macro from one that makes changes to the other, running various filters and formatting to end up creating about 50 pdf documents then closes both files. While all this is occuring the "working" label disappears

Formatting an email
Ive been using the outlook.application method to email results from various queries like this:

.Body = "1)" & Chr(13) & Chr(13) _
& s1 & Chr(13) _
& "2)" & Chr(13) & Chr(13) _
& s2 & Chr(13) & Chr(13) _
& "3)" & Chr(13) & Chr(13) _
& s3 & Chr(13) & Chr(13) _
& "4)" & Chr(13) & Chr(13) _
& s4 & Chr(13) _
& "5)" & Chr(13) & Chr(13) _
& s5 & Chr(13) & Chr(13) _
& "6)" & Chr(13) & Chr(13) _
& s6

It works perfectly but I would rather the results be shown in tables, like when you copy and paste selected cells from a select query into an email.