Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / March 2005

Tip: Looking for answers? Try searching our database.

calling subroutine

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lodewijk - 29 Mar 2005 06:26 GMT
I have a sub-routine that fills in a combobox:

Sub Box(FN, ComboBox, Waarde)
   With ComboBox
       Do While Not EOF(FN)
           Input #FN, MyString
           .AddItem MyString
       Loop
   End With
   For teller = 1 To ComboBox.ListCount
       If ComboBox.List(teller) = Waarde Then
           ComboBox.Text = ComboBox.List(teller)
       End If
   Next teller
End Sub

I want to use this to fill in all the comboboxes on my form. By calling this
with Call Box(FNBriefLayout, cboBriefLayout, MyUser(10, 3)), where
FNBrieflayout is the FileNumber, and cboBriefLayout is the name of the
combobox, It will not work.
But when I replace cboBriefLayout with "cboBriefLayout" it also does not
works.
How do I call this subroutine so that "With ComboBox" will be the same as
"With cboBriefLayout"?

Lodewijk
Marshall Barton - 29 Mar 2005 07:31 GMT
>I have a sub-routine that fills in a combobox:
>
[quoted text clipped - 20 lines]
>How do I call this subroutine so that "With ComboBox" will be the same as
>"With cboBriefLayout"?

Since you declared the Sub's arguments as Variants, you are
letting Access guess whether you want the combo box object
or its value.  It looks like it guessed wrong.

Sub Box(FN As Integer, ComboBox as ComboBox, Waarde As
String)

Note the ambiguity of using the name ComboBox for the second
argument.

Without putting any serious thought into this, I suspect
there's a simpler/cleaner way to get a combo box to use a
text file as a combo's RowSource.  Maybe you could link to
the text file??

Signature

Marsh
MVP [MS Access]

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.