Solved

InputBox giving type mismatch.

Posted on 2014-04-27
7
359 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 119

Expert Comment

by:Rey Obrero
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 119

Expert Comment

by:Rey Obrero
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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 119

Expert Comment

by:Rey Obrero
ID: 40026414
test this
Quotes.accdb
0
 
LVL 119

Expert Comment

by:Rey Obrero
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
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 different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now