Results 1 to 1 of 1
  1. #1
    Join Date
    Oct 2012
    Posts
    1

    Unanswered: Validate data of subform using combobox from main form

    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...

    any help will be appreciated..
    Thanks
    Attached Thumbnails Attached Thumbnails Untitled.png   Untitled.jpg  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •