Hi guys,
Implementations application & programming environ
MS Acess + Visual Basic
I am having an error (Data type mismatch criteria errors) on the last stat of the AfterUpdate event. I am aware that Str only take in Numerical values but nt too sure as hw that stat can be changed to take in string values.
I have invoked the save command to add the below mentioned to Student table but i want to filter dupliacte student Id value selected from the combo box. I have set the field to Yes(No Duplicate) but getting an error this will allow duplicate value, refined index or remove duplicate in the fields. No idea as to what is it but i have provided the necessary info for review. Tks for assisting on this issue,
OR
Implementations application & programming environ
MS Acess + Visual Basic
Code:
Table fields Serialno (pk) - Auto number StudentId - text Course - text intake - number
Code:
Control Combobox1 (StudentId) - predefined list TextBox1 (StudentId) - bound to controlsource StudentId TextBox2 (Course) - bound to controlsource course TextBox3(intake) userinput
Code:
Private_Sub_Combo1_AfterUpdate event Dim rs as Object Set rs = Me.RecordSetClone rs.FindFirst "[Serialno] = " Str(Nz(Me![Combo1])) If Not rs.EOF Then Me.Bookmark = rs.Bookmark Me.StudentId.value = Combo1.Column(0)
I have invoked the save command to add the below mentioned to Student table but i want to filter dupliacte student Id value selected from the combo box. I have set the field to Yes(No Duplicate) but getting an error this will allow duplicate value, refined index or remove duplicate in the fields. No idea as to what is it but i have provided the necessary info for review. Tks for assisting on this issue,
Code:
Private Sub_Save event
On_Error.......
Dim rs as RecordSet
Dim db as Database
Set rs = Me.RecordsetClone
Set db = CurrentDb
Set rs = db.OpenRecordSet("Select StudentId, Course, intake from Student where StudentId = '" & Me.StudentId.value & "' And Course = ''" & Me.Course.value & "')
If Not rs.EOF Then
rs.MoveNext
rs.AddNew
rs("StudentId").value = Combo1.value
rs("Course").value = text2.value
rs("intake").value = text3.value
rs.update
rs.close
End If
set rs = Nothing
set db = Nothing
Code:
Private Sub AddRecord event DoCmd.OpenForm "StudentRecord", acNormal, ,StudnetId = '" & Me.Combo1.Value & "' And course = '" & Me.textBox2.value & "' DoCmd, acAddForm DoCmd.GoToRecord , , acNewRec
Comment