i have a combo button on my form from which
i want to set them up with data from MY sql7 database
i have a Standard Module
From my form load event of my form i want to
open a publicfunction in my Standard Module that opens my database and then loads my sql query result into my
combobox on my main form.
my question is this:
why from my module is my combobox out of scope and
how do i declare the combobox so its in scope
the combobox is called cmbInterviewer:
the below code is in my module
Code:Public Function SetupHistoryCombo() Dim dyna As Recordset Dim theError As Long Dim theid As Long Dim myarray As String SQL = "select InterviewerShortDesc from interviewer" Set dyna = db.OpenRecordset(SQL, dbOpenSnapshot, dbSQLPassThrough + dbSeeChanges) theError = Err On Local Error GoTo 0 Select Case theError Case 0 Do Until dyna.EOF cmbInterviewed.AddItem = dyna("InterviewerShortDesc") 'this code above, the method additem does not work??? dyna.MoveNext Loop dyna.Close Set dyna = Nothing Case 3146 'No data Case Else MsgBox Error End Select End Function




Reply With Quote