I have a table containing Student_info including a Target field and Draft_tier.
I have another table Pap_info which contains fields Target and Tier.
I need to lookup the [Student_info].[target field] value in the Pap_info table and return the Tier value to be stored in the Draft_tier column (as a sort of default).
My initial efforts resulted in the following code which creates the datasheet I need but the data cant be edited.
Code:
strSQL = SQLSTR(Me.Combo_class.Value, Me.Yeargp.Value)
fieldtest = "[Mathematics_Group]"
group = Me.Combo_class.Value
Yr = Me.Yeargp.Value
For Each qdf In CurrentDb.QueryDefs
If qdf.Name = "newquery" Then
CurrentDb.QueryDefs.Delete "newquery"
Exit For
End If
Next
strSQL = "SELECT LOWER_SCHOOL_Students.[First name], LOWER_SCHOOL_Students.[Last name], LOWER_SCHOOL_Students.Mathematics_Group, Nov_tier.exam_tier_dft " _
& " FROM LOWER_SCHOOL_Students LEFT JOIN Nov_tier ON LOWER_SCHOOL_Students.[Mathematics_Target] = Nov_tier.grade" _
& " WHERE (((LOWER_SCHOOL_Students.[Mathematics_Group])=" & Chr(34) & group & Chr(34) & "));"
Set qdf = CurrentDb.CreateQueryDef("Newquery", strSQL)
DoCmd.OpenQuery "NewQuery", 0, acEdit
all help gladly appreciated.