Anyone help!!
I'm a student and a really beginner with access and never touch VBA before (and sorry if my english is all messy) anyway, I need help with how to validating data. I have a form with one subform, in the main form i have a combobox(Programme name) if a certain programme name is selected the combobox inside the subform will only give point to a certain subject
I've been playing with the VB and tried a few coding
Private Sub Form_Current()
Dim db As DAO.Database
Dim t2 As DAO.Recordset
Set db = CurrentDb
Set t2 = db.OpenRecordset("Table2 sub")
If programme.Value = "computer" Then
Do While Not Table2_sub.EOF
If Subject.Value = "Math" Or Me.Table2_sub!Subject.Value = "Geography" Then
Me.Table2_sub!Point.Value = 3
t2!.MoveNext
Loop
End If
End Sub
//////////////////////////////////
Private Sub programme_Change()
If programme.Value = "computer" And Me.Table2_sub!Subject.Value = "Math" Or Me.Table2_sub!Subject.Value = "Geography" Then
Me.Table2_sub!Point.Value = 3
End If
End Sub
this code worked but it only worked for one row in the subform...:eek:
any help will be appreciated..
Thanks
I'm a student and a really beginner with access and never touch VBA before (and sorry if my english is all messy) anyway, I need help with how to validating data. I have a form with one subform, in the main form i have a combobox(Programme name) if a certain programme name is selected the combobox inside the subform will only give point to a certain subject
I've been playing with the VB and tried a few coding
Private Sub Form_Current()
Dim db As DAO.Database
Dim t2 As DAO.Recordset
Set db = CurrentDb
Set t2 = db.OpenRecordset("Table2 sub")
If programme.Value = "computer" Then
Do While Not Table2_sub.EOF
If Subject.Value = "Math" Or Me.Table2_sub!Subject.Value = "Geography" Then
Me.Table2_sub!Point.Value = 3
t2!.MoveNext
Loop
End If
End Sub
//////////////////////////////////
Private Sub programme_Change()
If programme.Value = "computer" And Me.Table2_sub!Subject.Value = "Math" Or Me.Table2_sub!Subject.Value = "Geography" Then
Me.Table2_sub!Point.Value = 3
End If
End Sub
this code worked but it only worked for one row in the subform...:eek:
any help will be appreciated..
Thanks