473,769 Members | 3,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HELP Please! Type mismatch error

Hi there!

Please help me out here. I am an inch away from completing my
assignment.

I am very new to VBA but i have very less time to be efficient at it.

I am getting a type mismatch error when i click the button whose code
is:

Private Sub cmdOpen_Click()

'Open PDF

Dim Company_Name As String
Dim PurchaseOrder As String
Dim FilePath As String
Dim value As Integer

Me.Refresh

Text23.SetFocus
Company_Name = Text23.Text

PONo.SetFocus
PurchaseOrder = PONo.Text

FilePath = "G:\Custome r Services\Purcha se Orders\" & Company_Name & "\"
& PurchaseOrder

value = fHandleFile((Fi lePath), WIN_NORMAL)

End Sub
fHandleFile is a function which has to open up a pdf file.

The code for this function is this:

http://www.mvps.org/access/api/api0018.htm
Please help me here....i dont think is a big problem. :)

Regards,

-Rehan

Sep 22 '06 #1
2 1940
Your variable called value is an integer value, whereas the function
fHandleFile looks to be evaluating to a String. That's why you are
getting the type mismatch.

Just FYI:
Your code can be simplified like this.

Private Sub cmdOpen_Click()

'Open PDF

Dim FilePath As String
Dim value As Integer

Me.Refresh

FilePath = "G:\Custome r Services\Purcha se Orders\" & Me.Text23 & "\"
& Me.PONo

value = fHandleFile((Fi lePath), WIN_NORMAL)

End Sub

It is also a good idea to name your form fields meaningful names, not
Text23. I believe you will be glad you did in the long run. You will
probably need a file extention in your file path as well, .pdf perhaps.

Hope that helps!

Rehan wrote:
Hi there!

Please help me out here. I am an inch away from completing my
assignment.

I am very new to VBA but i have very less time to be efficient at it.

I am getting a type mismatch error when i click the button whose code
is:

Private Sub cmdOpen_Click()

'Open PDF

Dim Company_Name As String
Dim PurchaseOrder As String
Dim FilePath As String
Dim value As Integer

Me.Refresh

Text23.SetFocus
Company_Name = Text23.Text

PONo.SetFocus
PurchaseOrder = PONo.Text

FilePath = "G:\Custome r Services\Purcha se Orders\" & Company_Name & "\"
& PurchaseOrder

value = fHandleFile((Fi lePath), WIN_NORMAL)

End Sub
fHandleFile is a function which has to open up a pdf file.

The code for this function is this:

http://www.mvps.org/access/api/api0018.htm
Please help me here....i dont think is a big problem. :)

Regards,

-Rehan
Sep 22 '06 #2
"Rehan" <mr*******@gmai l.comwrote in
news:11******** *************@b 28g2000cwb.goog legroups.com:
Hi there!

Please help me out here. I am an inch away from completing my
assignment.

I am very new to VBA but i have very less time to be efficient
at it.

I am getting a type mismatch error when i click the button
whose code is:

Private Sub cmdOpen_Click()

'Open PDF

Dim Company_Name As String
Dim PurchaseOrder As String
Dim FilePath As String
Dim value As Integer

Me.Refresh

Text23.SetFocus
Company_Name = Text23.Text

PONo.SetFocus
PurchaseOrder = PONo.Text

FilePath = "G:\Custome r Services\Purcha se Orders\" &
Company_Name & "\" & PurchaseOrder

value = fHandleFile((Fi lePath), WIN_NORMAL)

End Sub
fHandleFile is a function which has to open up a pdf file.

The code for this function is this:

http://www.mvps.org/access/api/api0018.htm
Please help me here....i dont think is a big problem. :)

Regards,

-Rehan
from the code at mvps, this line
fHandleFile = lRet & _
IIf(stRet = "", vbNullString, ", " & stRet)
tells me you need to change the declaration (Dimstatement) of
value to Variant
--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Sep 22 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1953
by: the_proud_family | last post by:
HELP ME PLEASE!! my email is the_proud_family@yahoo.com I can't get the ball to go up right side and then I need it to turn around and keep turning until velocity=0 I have been at it for the past 2 weeks now i give up and call for help. Please if anyone can gide me through i will be so grateful!! I have pasted my code below
0
1702
by: Kurt Watson | last post by:
I’m having a different kind of problem with Hotmail when I sign in it says, "Web Browser Software Limitations Your Current Software Will Limit Your Ability to Use Hotmail You are using a web browser that Hotmail does not support. If you continue to use your current browser software we cannot guarantee that Hotmail will work correctly for you". Please help, this is very annoying. I have been searching for help on
7
2392
by: Alan Bashy | last post by:
Please, guys, In need help with this. It is due in the next week. Please, help me to implement the functions in this programm especially the first three constructor. I need them guys. Please, help me. This was inspired by Exercise 7 and Programming Problem 8 in Chapter 3 of our text. I have done Exercise 7 for you: Below you will find the ADT specification for a string of characters. It represents slightly more that a minimal string...
17
2037
by: JT | last post by:
Help me the following C++ question: Write a program to help a local bookshop automate its billing system. The program should do the following: (a)Let the user enter the ISBN, the system will trace the title and price of the book automatically. The system should check whether the book is in the stock or not. If it is not, please let the user to enter again. (b)Allow a customer to buy more than one item from the bookshop.
13
2149
by: sd00 | last post by:
Hi all, can someone give me some coding help with a problem that *should* be really simple, yet I'm struggling with. I need the difference between 2 times (Target / Actual) However, these times will fall somewhere between a Start & End time Further more, there will be Break & Lunch times between Start & End. Example... Start 08:00 Break start 10:30
1
1604
by: alfie27 | last post by:
Hi, Here is what the final output to the screen should look like. Below this is the code I have so far. Can someone please help me as to what i need to do next?? I'm really clueless right now. Thanks! Point of Sale Terminal ----------------- 1. Record a Transaction 2. Transaction History
6
1470
by: rajbala.3399 | last post by:
Hi, I created two forms. In the first frame i had Items with checkbox like names of students etc. When ever i checked on any name It's display on the other frame. Up to know it's fine. But when i deselcted any check box it again display same name. My requirement is when i deselected the checkbox that particular student name is deleted from the list . Any one please give suggestion for above problem. your help will be appricited. TankQ.
21
2552
by: asif929 | last post by:
I need immediate help in writing a function program. I have to write a program in functions and use array to store them. I am not familiar with functions and i tried to create it but i fails to run, However, i simply created this program in arrays and it runs good except i cant figure out how to compute the standard deviation. The coding is below. Any help will be appreciated. 1) The Program will prompt the user for six grades to be...
2
3819
by: slizorn | last post by:
hi guys, i need to make a tree traversal algorithm that would help me search the tree.. basically i need to read in a text file... shown below H H,E,L E,B,F B,A,C A,null,null c,null,D
2
2661
by: slizorn | last post by:
hi guys, i need to make a tree traversal algorithm that would help me search the tree.. creating a method to search a tree to find the position of node and to return its pointer value basically i need to read in a text file... shown below H H,E,L E,B,F B,A,C A,null,null
0
9422
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10206
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10035
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8863
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7403
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3556
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2811
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.