i want to create a form which when i enter an ID no, it will view the info about the customer.
and when i enter an ID which is not in the database, a message box will pop up.
i've created my database using ms access.
this is halfway done by me.
my db + vb file: http://www.mediafire.com/?jaimfyfttez (refer to the form named frmViewInfo)
Code:Private dbcon As New ADODB.Connection Private rsCustomer As New ADODB.Recordset Sub openDBConnection() Dim strconn As String strconn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=D:\Documents\Works\MTD2013 - SISTEM PANGKALAN DATA\Laundry System\Laundry System.mdb;" & _ "Jet OLEDB:Database Password=;" & _ "Jet OLEDB:Engine Type=5;" dbcon.Open strconn End Sub Private Sub Form_Load() Me.txtICNo.Text = "" Call openDBConnection Call openCustomerRecord End Sub Sub openCustomerRecord() Dim strSQL As String strSQL = "SELECT * FROM Customer" rsCustomer.Open strSQL, dbcon, 3, 1 End Sub Private Sub cmdEnter_Click() Me.txtFName.Locked = True Me.txtLName.Locked = True Me.txtPhoneNo.Locked = True Me.txtDSent.Locked = True Me.txtDTaken.Locked = True Me.txtRegClean.Locked = True Me.txtDryClean.Locked = True Me.txtTotal.Locked = True Me.txtFName.Text = rsCustomer!fName Me.txtLName.Text = rsCustomer!lName Me.txtPhoneNo.Text = rsCustomer!phoneNo End Sub




Reply With Quote