I am trying to pre-populate a combo box before I display the form with the list. Seems like it should be easy. It blows up when I try to call the form; highlighted in Red
Anybody have the correct syntax for me? Many thanks!
Alan
Code:
Private Sub cmdCompares_Click()
Dim RS As Recordset
Dim DB As Database
Dim SQstr As String
On Error GoTo cmdCompares_Click_Err
SQstr = "SELECT DISTINCT dbo_InfraApps.[Application Name] FROM dbo_InfraApps "
SQstr = SQstr & "ORDER BY dbo_InfraApps.[Application Name];"
Set DB = CurrentDb
Set RS = DB.OpenRecordset(SQstr, dbOpenDynaset, dbSeeChanges)
RS.MoveFirst
With [COLOR=#A40000]Forms!frmchooseapp.cboapplic[/color]
Do While Not RS.EOF
.AddItem RS![Application Name]
RS.MoveNext
Loop
End With
DoCmd.OpenForm "frmChooseApp", acNormal, "", "", , acNormal
Alan