Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 6th, 2007, 02:28 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Also, try typig some of this in. See if when you type bEnd = that you get an autocomplete with a True False selection.

mmcdonal
 
Old July 6th, 2007, 02:30 PM
Authorized User
 
Join Date: Aug 2006
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by mmcdonal
 I ran this and it worked. Did we spell Boolean correctly?

Dim bEnd As Boolean

bEnd = False

MsgBox bEnd


mmcdonal
Sure looks right to me.

Code:
Dim objFSO As Variant
Dim objFile As Variant
Dim sFileName As String
Dim sContents As String
Dim sTopic As String
Dim sDesc As String
Dim sColName As String
Dim rs As ADODB.Recordset
Dim sSQL As String
Dim bEnd As Boolean

bEnd = False

MsgBox bEnd
 
Old July 6th, 2007, 02:33 PM
Authorized User
 
Join Date: Aug 2006
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by mmcdonal
 Also, try typig some of this in. See if when you type bEnd = that you get an autocomplete with a True False selection.

mmcdonal
I thought of that, tried it, and got the same thing.

 
Old July 6th, 2007, 02:37 PM
Authorized User
 
Join Date: Aug 2006
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by mmcdonal
If bDesc = True And sColName <> "End" Then
   sDesc = sDesc & Right(sContents, (Len(sContents) - 5))
End If

Select Case
   Case "DESC"
        bDesc = True
        sDesc = Right(sContents, (Len(sContents) - 5))
   Case "END "
        bEnd = True
        bDesc = False
End Select
So, just so I can understand, this is starting on the line beginning with DESC and continuing till it finds the "END " line? Because that would be the ideal situation.

 
Old July 6th, 2007, 02:41 PM
Authorized User
 
Join Date: Aug 2006
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Okay, got the bEnd problem fixed. I was dumb.

 
Old July 6th, 2007, 02:48 PM
Authorized User
 
Join Date: Aug 2006
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Okay, it might be because I put the new code in the wrong order, but this chunk of code is giving me an invalid call procedure or argument.

Specifically it is the sixth line down of this chunk.
Code:
   Set objFile = objFSO.OpenTextFile(sFileName)
       Do Until objFile.AtEndOfStream
          sContents = objFile.ReadLine
          sColName = Left(sContents, 4)
          If bDesc = True And sColName <> "End" Then
            sDesc = sDesc & Right(sContents, (Len(sContents) - 5))
          End If
          Select Case sColName
            Case "Topi"
                sTopic = Right(sContents, (Len(sContents) - 6))
            Case "DESC"
                bDesc = True
                sDesc = Right(sContents, (Len(sContents) - 5))
            Case "END"
                bEnd = True
                bDesc = False
'Other cases?
          End Select
 
Old July 9th, 2007, 06:09 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Okay, do this first:

If bDesc = True And sColName <> "End " Then

You have to add that space for sColName since there are 4 characters in that string.

I am not sure why this code doesn't work since I tried it and it works for me.
            sDesc = sDesc & Right(sContents, (Len(sContents) - 5))



mmcdonal





Similar Threads
Thread Thread Starter Forum Replies Last Post
importing flat file into Access 2007 olgolg VBScript 0 March 29th, 2008 07:53 AM
Masking flat file longs Linux 0 August 2nd, 2007 04:50 PM
Need help with my Flat File Schema cmiller66 Biztalk 0 August 21st, 2006 10:48 PM
flat file login new2php PHP How-To 0 February 7th, 2006 07:02 AM
Converting Flat File Database to Relational DB rj_655@hotmail.com Access 5 June 12th, 2004 09:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.