Drop Table
Support Forum for database administrators and web based access to important newsgroups related to databasesI'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
Post Follow-up to this messageI 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
Post Follow-up to this messageyou can only use mid(string,1,1) = "h" in VBA + VB6 etc you can not use this construct in VBScript
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread