|
-
Nov 8th, 2000, 03:54 PM
#1
Thread Starter
Lively Member
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
-
Nov 8th, 2000, 04:04 PM
#2
Addicted Member
You say your combo is called cmbInterviewer, but I see
cmbInterviewed in your code?
Try refrencing the form before the cobobox name
Example:
formName.cmbInterviewed.additem...
where formName is the form containing the combobox?
-
Nov 8th, 2000, 04:20 PM
#3
Thread Starter
Lively Member
i am
i am calling my module from the form load event
so when in the module i use
Code:
frmCandidate.cmbInterviewed.AddItem dyna("InterviewerShortDesc")
it gets to this code then pops out of my function back at the form load event then gets to the part in the form load event that calls my function in my module and does a complete loop which i dont want
i have seen people declare in there module functions
Code:
Public Function SetupHistoryCombo(cmbinterviewed as combobox)
what does this mean i have tried it this way and in my module when i type my comboboxname. i can see the different
options i can use with this control
but when i run the project i get an error when my fuction is called up from the form load event.????
any ideas???
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|