I have a combo box on a form and I want to load some items in this combo box at run time from a database table of access. For this I have written below code. But when I start my program this message appears.
Run-time error '91':
Object variable or With bock variable not set
Code is this:
Private Sub Form_Load()
Dim A As String
Data1.Recordset.MoveFirst
Do While Data1.Recordset.EOF <> True
A = Data1.Recordset.Fields("Religion") & ""
If A <> "" Then
Combo1.AddItem A
End If
Data1.Recordset.MoveNext
Loop
End Sub