Solved

InputBox giving type mismatch.

Posted on 2014-04-27
7
376 Views
Last Modified: 2014-04-27
I post on a website often and I sometimes like to use appropriate quotes depending on the topic. So what I want to do is get the quote and author already prepped for HTML posting. I have them stored in an Access DB.

The quick and easy way should be just putting the default of an InputBox and copy from there. But it errors out on the InputString = InputBox(Msg, Title, OutputString) as 13:  Type mismatch.

Any ideas?


Private Sub PrepQuote_Click()

Dim Quote As String
Dim Author As String
Dim OutputString As String
Dim InputString As String
Dim Msg As String
Dim Title As String

Quote = CStr(Me.QuoteStrTxtBox.Value)
Author = CStr(Me.AuthorTxtBox.Value)

OutputString = CStr("<i>" & Quote & "</i> -- " & Author)

Msg = "HTML formatting"
Title = "Quote"

InputString = InputBox(Msg, Title, OutputString)

End Sub

Open in new window


The OutputString looks like
<i>To be amused by what you read - that is the great spring of happy quotations.</i> -- C. E. Montague

Open in new window

0
Comment
Question by:Jim P.
[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
  • 4
  • 2
7 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40026388
I see nothing wrong with the codes...

try a compact and repair then debug>compile

check if you have missing references.

also, try commenting the whole Private Sub PrepQuote_Click() codes, then do  a Debug > compile, see if there are other errors.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40026390
I copied the codes to a module

Sub PrepQuote()

Dim Quote As String
Dim Author As String
Dim OutputString As String
Dim InputString As String
Dim Msg As String
Dim Title As String

Quote = "To be amused by what you read - that is the great spring of happy quotations."
Author = "C. E. Montague"
OutputString = CStr("<i>" & Quote & "</i> -- " & Author)

Msg = "HTML formatting"
Title = "Quote"

InputString = InputBox(Msg, Title, OutputString)

End Sub

Open in new window



and I got this

x
0
 
LVL 38

Author Comment

by:Jim P.
ID: 40026398
Hey Ray (cap),

I re-tried the compile and C&R and am still getting it. It's an Acc2k7 with SP's installed.

I've attached it. This is irritating to me.
Quotes.zip
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
LVL 34

Accepted Solution

by:
Norie earned 500 total points
ID: 40026410
The problem is that you have a control on the form with the name InputBox.

You need to change that or use this.
InputString = VBA.InputBox(Msg, Title, OutputString)

Open in new window

0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40026414
test this
Quotes.accdb
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40026416
imnorie is correct, sorry did not see your post.

anyway, I changed the name of the textbox "InputBox"
0
 
LVL 38

Author Closing Comment

by:Jim P.
ID: 40026431
Slap me for a stupid mistake. I forgot it was a keyword.
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
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…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

632 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