Solved

type Mismatch on text and function concatenation

Posted on 2014-01-27
8
358 Views
Last Modified: 2014-01-31
I am try to create the form caption on the fly,  it works on 1 form by not on another,

What am I missing?

Private Sub Form_Load()

   On Error GoTo Form_Load_Error

    Me.lblCaption_start.Caption = "CompanyName" & Year(Date) & " CONTRACT YEAR"
   
   On Error GoTo 0
   Exit Sub

Form_Load_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Form_Load of VBA Document Form_frmPassword"
End Sub

Open in new window

0
Comment
Question by:Karen Schaefer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 10

Expert Comment

by:Gozreh
ID: 39812653
is the "lblCaption_start" a Label Field ?
do you have a field on this form called "Date" ? you should type Date()
0
 
LVL 70

Assisted Solution

by:Éric Moreau
Éric Moreau earned 250 total points
ID: 39812689
if you want to change the form's caption, you need to set the Text property of the form:

Me.text = "CompanyName" & Year(Date) & " CONTRACT YEAR"
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 125 total points
ID: 39812780
Form Caption ?

Private Sub Form_Load()

Me.Caption = "CompanyName " & Year(Date) & " CONTRACT YEAR"

End Sub
0
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 
LVL 75
ID: 39812803
Also ... is CompanyName  supposed to be a Variable ?

Because as is the Caption is going to look like this:

CompanyName 2014 CONTRACT YEAR

?
0
 
LVL 31

Assisted Solution

by:Helen Feddema
Helen Feddema earned 125 total points
ID: 39813245
Try saving the entire caption to a String variable and displaying it in the Immediate Window with a Debug.Print statement.  The syntax looks OK, but as another poster mentioned, there could be a problem if you have a field (or control) called Date, since it could be confused with the Date() function.
0
 

Author Closing Comment

by:Karen Schaefer
ID: 39824534
THANKS FOR THE INPUT
0
 
LVL 75
ID: 39824714
"you need to set the Text property of the form:"

Karen ... there is no such property 'text' of a Form.  So, I'm confused as to why 250 pts was assigned to this post ?

mmx
0
 

Author Comment

by:Karen Schaefer
ID: 39824741
sorry the points where suppose to be spread equally for time and effort.

K
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question