Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

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)=o
bjResults.Fields("cust").Value 'cust
 mid(strRecord,7,30)=
objResults.Fields("ship1").Value 'ship1
 mid(strRecord,37,30)
=objResults.Fields("ship2").Value 'ship2
 mid(strRecord,67,30)
=objResults.Fields("ship3").Value 'ship3
else
mid(strRecord,1,1)="D"
END IF
objStream. WriteLine(strRecord)

TicketID=objResults.Fields("ticket").Value
objResults.Movenext


Wend


Report this thread to moderator Post Follow-up to this message
Old Post
mychevworld@yahoo.com
04-22-05 01:24 AM


Re: VBScrip Type Mismatch Error
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=ADicket").Value then
strRecord =3D "H"
strRecord =3D strRecord +
objResults.=ADFields("cust").Value 'cust
strRecord =3D strRecord +
objResults=AD.Fields("ship1").Value 'ship1
strRecord =3D strRecord +
objResult=ADs.Fields("ship2").Value 'ship2
strRecord =3D strRecord +
objResult=ADs.Fields("ship3").Value 'ship3
strRecord =3D strRecord + Space(333 -
Len(strRecord))
else
strRecord=3D"D"
strRecord =3D strRecord + Space(333 -
Len(strRecord))
END IF
objStream. WriteLine(strRecord)

 TicketID=3DobjResult
s.Fields("ti=ADcket").Value
objResults.Movenext=20


Wend


Report this thread to moderator Post Follow-up to this message
Old Post
mahajan.sanjeev@gmail.com
04-22-05 01:24 AM


Re: VBScrip Type Mismatch Error
you can only use mid(string,1,1) = "h" in VBA + VB6 etc

you can not use this construct in VBScript


Report this thread to moderator Post Follow-up to this message
Old Post
Alex
04-22-05 12:23 PM


Sponsored Links





Last Thread Next Thread
Post New Thread

Microsoft SQL Server forum archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 04:47 AM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006