473,406 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

VBScrip Type Mismatch Error

I'm getting a type mismatch error on the mid(strRecord,1,1)="H" line. I
used to do this all of the time, but I haven't done any VBScript for
awhile, so I'm sure I'm forgetting something.

While not objResults.EOF
strRecord=String( 333 ,32 )
IF TicketID<>objResults.Fields("ticket").Value then
Mid(strRecord,1,1)="H"
mid(strRecord,2,5)=objResults.Fields("cust").Value 'cust
mid(strRecord,7,30)=objResults.Fields("ship1").Val ue 'ship1
mid(strRecord,37,30)=objResults.Fields("ship2").Va lue 'ship2
mid(strRecord,67,30)=objResults.Fields("ship3").Va lue 'ship3
else
mid(strRecord,1,1)="D"
END IF
objStream.WriteLine(strRecord)
TicketID=objResults.Fields("ticket").Value
objResults.Movenext
Wend

Jul 23 '05 #1
2 2636
I think you have messed up with the Mid function. Mid return a string
and it cannot be used the way you are using it. I would approach the
whole script differently:

While not objResults.EOF
IF TicketID<>objResults.Fields("t*icket").Value then
strRecord = "H"
strRecord = strRecord +
objResults.*Fields("cust").Value 'cust
strRecord = strRecord +
objResults*.Fields("ship1").Value 'ship1
strRecord = strRecord +
objResult*s.Fields("ship2").Value 'ship2
strRecord = strRecord +
objResult*s.Fields("ship3").Value 'ship3
strRecord = strRecord + Space(333 -
Len(strRecord))
else
strRecord="D"
strRecord = strRecord + Space(333 -
Len(strRecord))
END IF
objStream.WriteLine(strRecord)
TicketID=objResults.Fields("ti*cket").Value
objResults.Movenext
Wend

Jul 23 '05 #2
you can only use mid(string,1,1) = "h" in VBA + VB6 etc

you can not use this construct in VBScript

Jul 23 '05 #3

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

Similar topics

5
by: Arun Wadhawan | last post by:
Hello MY SQL Server is causing me this problem : Microsoft VBScript runtime error '800a000d' Type mismatch: 'ident' >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> I am getting from...
1
by: LJgrnl | last post by:
I've got a type mismatch error that's driving me nutty. Variable blnNoData has the initial value False. If a recordset comes back empty (both .EOF and ..BOF are true) then blnNoData is set to...
4
by: Mike | last post by:
I am getting a type mismatch error when I do a bulk insert. ---Begin Error Msg--- Server: Msg 4864, Level 16, State 1, Line 1 Bulk insert data conversion error (type mismatch) for row 1, column...
0
by: news.paradise.net.nz | last post by:
I have been developing access databases for over 5 years. I have a large database and I have struck this problem with it before but can find nothing in help or online. Access 2000 I have a query...
1
by: amitbadgi | last post by:
I am getting the following error while converting an asp application to asp.net Exception Details: System.Runtime.InteropServices.COMException: Data type mismatch in criteria expression. ...
3
by: amitbadgi | last post by:
I am getting teh following error while converting an asp application to asp.net, Exception Details: System.Runtime.InteropServices.COMException: Type mismatch. Source Error: Line...
1
by: Brett | last post by:
I have a form that calls a method within a DLL. By clicking a button on the form, the DLL is instantiated and the SaveOutlookMessage() method invoked. The DLL code copies messages from Outlook to...
6
by: Howard Kaikow | last post by:
I'm doing a VB 6 project in which I am trying to protect against type mismatch errors. Is the process any different in VB .NET? Here's what I'm doing in VB 6. I have an ActiveX DLL. The...
9
by: sara | last post by:
Hi - I have code (below) that ran as recently as Monday. We decided to change the location for the output reports, and now the code errors (13 Type Mismatch) on the query. The query runs fine...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...
0
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...

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.