hi, can anyone please check why im getting dataype mismatch error... im using combobox and msaccess db which consist of formNo(autonumber) LastName FirstName MiddleName Address (text) ... if i use address as valuemember there is no error,, but if i use FormNo as valuemember then there this datatype mismatch error.. here is my codes..
Private Sub frmPayment_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cmbName.Enabled = False
Try
'Dim fillcon As New OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=path to access file.mdb;")
Dim asql As String = ("SELECT LastName +', '+ FirstName +' '+ MiddleName AS FullName,FormNo FROM tbleMember")
Dim da As New OleDbDataAdapter(asql, MyConn)
Dim ds As New DataSet
ds.Clear()
da.Fill(ds)
cmbName.DisplayMember = "FullName"
cmbName.ValueMember = "FormNo"
cmbName.DataSource = ds.Tables(0)
cmbName.SelectedIndex = 0
Catch ex As Exception
MsgBox("ERROR : " & ex.Message.ToString)
End Try
End Sub
Private Sub cmbName_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbName.SelectedIndexChanged
MyConn.Open()
Try
Dim myCommand As OleDbCommand
myCommand = New OleDbCommand("SELECT * FROM tbleMember WHERE FormNo='" & cmbName.SelectedValue.toString & "'", MyConn)
Dim reader As OleDbDataReader = myCommand.ExecuteReader
While reader.Read()
txtIDNum.Text = reader("FormNo")
End While
reader.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End sub
im stuck with this..thanks in advance...