Access 2000 problem

M

Matt

Hi there

I have an application written in Access 2003. The format is access 2000 as
is being developed for clients using the older version.

I have a form that shows a list box which is set to display a list of word
documents that relate to a particular record. To poplulate this list box i
am using the following code:

Dim myPath As String
Dim myFile As String
Dim intIndex As Integer
myPath = DLookup("[saved_directory]", "tblReportParameters", "[type] =
'domestic_quote'")
myFile = Dir(myPath & Forms!frmDomesticQuoteForms!quoteN & "*" &
Forms!frmDomesticQuoteForms!txtLastName & "*.doc")
If IsNull(Me.quoteN) Then
myFile = ""
End If
intIndex = 0
Do While myFile <> ""
Me.lstFiles.Visible = True
Me.lstFiles.AddItem Item:=myFile, Index:=intIndex
myFile = Dir()
intIndex = intIndex + 1
Loop

The problem i have is that although this works fine in access 2003, in
access 2000 i get an error as it doesn't support AddItem

My question is does anybody know of a way to do this in access 2000?

Thanks hopefully in advance

Matt
 
D

Douglas J Steele

Dim strRowSource As String

strRowSource = vbNullString
Do While Len(myFile) > 0
strRowSource = strRowSource & myFile & ";"
myFile = Dir()
Loop
If Len(strRowSource) > 0 Then
strRowSource = Left$(strRowSource, Len(strRowSource) - 1)
Me.lstFiles.RowSourceType = "Value List"
Me.lstFiles.RowSource = strRowSource
Me.lstFiles.Visible = True
End If

This will replace what's in the list box: if you want to add to what's
already there, set

strRowSource = Me.lstFIles.RowSource

before starting.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top