Sorry my bad!! I posted the wrong Module. Its suppose to be LoadDatabase_Cust
Anyway ive been tinkering for awhile and now i got *Type MisMatch* from
The LoadDatabase_Cust ModuleCode:Dim rsDataCust As DAO.Recordset Dim DBConnectionCust As ADODB.Connection -------------------------- Private Sub CmdMain_Click() Unload Me FrmMain.Show End Sub -------------------- Private Sub CmdNext_Click() WriteRecord rsDataCust.Update MsgBox "Patient successfully added !", vbOKOnly txtCustId.Text = " " TxtCustName.Text = " " TxtCustPhone.Text = " " TxtCustAdd.Text = " " TxtCustLID.Text = " " TxtCustIC.Text = " " TxtCustAge.Text = " " End Sub ------------------- Private Sub Form_Load() Set DBConnectionCust = LoadDatabase_Cust(App.Path & "\LoginTest.mdb")^ ^ ^ ^ This line here is the mismatch End Sub ------------------------- Public Sub WriteRecord() With rsDataCust .Edit !cust_id = txtCustId !cust_name = TxtCustName !cust_phone = TxtCustPhone !cust_add = TxtCustAdd !cust_license = TxtCustLID !cust_ic = TxtCustIC !cust_age = TxtCustAge End With End SubProblem Code:
Set rsDataCust = DBConnectionCust.Execute("SELECT * FROM CUSTOMER")
For a better view ive included the forms etc in this rar.Code:Public DBConnectionCust As ADODB.Connection Public Function LoadDatabase_Cust(ByVal DatabaseName As String, Optional ByVal cust_id As Integer, Optional ByVal cust_name As String, Optional ByVal cust_add As String, Optional ByVal cust_phone As String, Optional ByVal cust_ic As String, Optional ByVal cust_license As String, Optional ByVal cust_age As String) As ADODB.Connection Dim ConnectionData_Cust As ADODB.Connection Set ConnectionData_Cust = New ADODB.Connection ConnectionData_Cust.Provider = "Microsoft.Jet.OLEDB.4.0" ConnectionData_Cust.ConnectionString = "Data Source = " & DatabaseName ConnectionData_Cust.CursorLocation = adUseClient ConnectionData_Cust.Open = ("Select * FROM CUSTOMER") Set LoadDatabase_Cust = ConnectionData_Cust End Function
Username : Admin
(Case sensitive) Password : Test
Login Test.rar




Reply With Quote