By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,506 Members | 2,282 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,506 IT Pros & Developers. It's quick & easy.

Continous Form

100+
P: 553
Hi

I know how to implement Continous form. In the method i have tried, the source for data on the continous form comes from table using SQL query

Now, i want to try something different and i need your help.

With the same continous form, i want the source for the data to be a simple piece of code that returns names of files in the folder.

I have completed working code for getting file names in the folder:

Expand|Select|Wrap|Line Numbers
  1. Dim fs
  2. Set fs = Application.FileSearch
  3. With fs
  4. .LookIn = "c:\abc"
  5. .FileName = "*.doc"
  6. .searchsubfolders = False
  7. fs.Execute
  8.  
  9. For j = 1 To .Foundfiles.Count
  10. MsgBox .Foundfiles(j)
  11. ' --------- Me.subf.Form.RecordSource = .Foundfiles(j)   -- how to do this thing? ---
  12. Next j
  13. End With
  14.  
There is no problem with that. Now please help me in displaying the result of the above code (returned using .FoundFiles(j) )
on the continous form.. How to go about doing this?

Awaiting your responce

Thanks
qi
Jul 24 '08 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 634
Hi

I know how to implement Continous form. In the method i have tried, the source for data on the continous form comes from table using SQL query

Now, i want to try something different and i need your help.

With the same continous form, i want the source for the data to be a simple piece of code that returns names of files in the folder.

I have completed working code for getting file names in the folder:

Expand|Select|Wrap|Line Numbers
  1. Dim fs
  2. Set fs = Application.FileSearch
  3. With fs
  4.     .LookIn = "c:\abc"
  5.     .FileName = "*.doc"
  6.     .searchsubfolders = False
  7.     fs.Execute
  8.  
  9.     For j = 1 To .Foundfiles.Count
  10.  
  11.         ' --------- Me.subf.Form.RecordSource = .Foundfiles(j)   -- how to do this thing? ---
  12.     Next j
  13. End With
  14.  
There is no problem with that. Now please help me in displaying the result of the above code (returned using .FoundFiles(j) )
on the continous form.. How to go about doing this?

Awaiting your responce

Thanks
qi
Hi

Why do you want to display then in a continuous form?

It would be pretty simple to display them in a list box !?

Expand|Select|Wrap|Line Numbers
  1. With fs
  2.     .LookIn = "c:\abc"
  3.     .FileName = "*.doc"
  4.     .searchsubfolders = False
  5.     fs.Execute
  6.  
  7.     Dim strSource as String
  8.     strSource = ";"
  9.     For j = 1 To .Foundfiles.Count
  10.         strSource =  & strSource & ";" & .Foundfiles(j)
  11.     Next j 
  12. End With
  13.  
  14. List1.RowSourceType = "Value List"
  15. List1.RowSource = Mid(strSource,2)      '--Mid()  Remove leading ';'
  16.  
??

MTB
Jul 25 '08 #2

100+
P: 553
Thanks a lot for this suggestion MTB.

It would be more easily readable the list on a Continous Form instead.

Could you please guide me if this could be done.

Perhaps, save the returned values into a table then query the table to assign its result to the Continous Form -this should work but is a lengthy way though!

Let me know any solutions for this

Thanks
Qi

Hi

Why do you want to display then in a continuous form?

It would be pretty simple to display them in a list box !?

Expand|Select|Wrap|Line Numbers
  1. With fs
  2.     .LookIn = "c:\abc"
  3.     .FileName = "*.doc"
  4.     .searchsubfolders = False
  5.     fs.Execute
  6.  
  7.     Dim strSource as String
  8.     strSource = ";"
  9.     For j = 1 To .Foundfiles.Count
  10.         strSource =  & strSource & ";" & .Foundfiles(j)
  11.     Next j 
  12. End With
  13.  
  14. List1.RowSourceType = "Value List"
  15. List1.RowSource = Mid(strSource,2)      '--Mid()  Remove leading ';'
  16.  
??

MTB
Jul 25 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.