Solved

InputBox giving type mismatch.

Posted on 2014-04-27
7
370 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

734 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