Solved

InputBox giving type mismatch.

Posted on 2014-04-27
7
366 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.
  • 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
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 33

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

840 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