Guys~
I have this SQL code but I'm not sure what wrong with it. it seems to work but the problem is when i click my combo box, nothing is there(no data at all, I already set the data source).
Here is the code
Option Compare Database
Private Sub Form_Current()
On Error Resume Next
Dim strProg As String
If IsNull(cmbName.Value) Then
ProGrp.Value = Null
End If
strProg = DLookup("[programme]", "Table1", "[Name]='" & cmbName.Value & "'")
Select Case strProg
Case "Computer"
ProGrp.Value = 1
MsgBox "Your have been checked."
Case "Accounting"
ProGrp.Value = 2
Case "Interior"
ProGrp.Value = 3
End Select
cmbName.RowSource = "Select Table1.Name " & _
"FROM Table1 " & _
"WHERE Table1.programme = '" & strProg & "' " & _
"ORDER BY Table1.Name;"
End Sub
Private Sub ProGrp_AfterUpdate()
On Error Resume Next
Dim strProg As String
Select Case ProGrp.Value
Case 1
strProg = "Computer"
MsgBox "Your have been checked."
Case 2
strProg = "Accounting"
Case 3
strProg = "Interior"
End Select
cmbName.RowSource = "Select Table1.Name " & _
"FROM Table1 " & _
"WHERE Table1.programme = '" & strProg & "' " & _
"ORDER BY Table1.Name;"
End Sub
Thanks..
I have this SQL code but I'm not sure what wrong with it. it seems to work but the problem is when i click my combo box, nothing is there(no data at all, I already set the data source).
Here is the code
Option Compare Database
Private Sub Form_Current()
On Error Resume Next
Dim strProg As String
If IsNull(cmbName.Value) Then
ProGrp.Value = Null
End If
strProg = DLookup("[programme]", "Table1", "[Name]='" & cmbName.Value & "'")
Select Case strProg
Case "Computer"
ProGrp.Value = 1
MsgBox "Your have been checked."
Case "Accounting"
ProGrp.Value = 2
Case "Interior"
ProGrp.Value = 3
End Select
cmbName.RowSource = "Select Table1.Name " & _
"FROM Table1 " & _
"WHERE Table1.programme = '" & strProg & "' " & _
"ORDER BY Table1.Name;"
End Sub
Private Sub ProGrp_AfterUpdate()
On Error Resume Next
Dim strProg As String
Select Case ProGrp.Value
Case 1
strProg = "Computer"
MsgBox "Your have been checked."
Case 2
strProg = "Accounting"
Case 3
strProg = "Interior"
End Select
cmbName.RowSource = "Select Table1.Name " & _
"FROM Table1 " & _
"WHERE Table1.programme = '" & strProg & "' " & _
"ORDER BY Table1.Name;"
End Sub
Thanks..