Dim dbnil As Database (not identifying the database name by the APP.Path)
Dim rscustomer As Recordset


Private Sub Command1_Click()
If Text1 = "" Then
MsgBox "please enter ID", vbCritical, "customer"
Text1.SetFocus
Else
If Text2 = "" Then
MsgBox "please enter the name", vbCritical, "customer"
Text2.SetFocus
Else
rscustomer.AddNew

customer(" ID") = Text1
customer("name") = Text2
customer.Update
MsgBox "Customer information accepted", vbInformation, "customer"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
End If
End If

End Sub

Private Sub Form_Load()
Set dbnil= OpenDatabase(App.Path & "\Customer.mdb")
Set rsCustomer = dbnil.OpenRecordset("Customertable")
MsgBox (test)
End Sub

Recommended Answers

All 5 Replies

what exactly your question is???

your code looks absolutely OK.

then what??

the problem is when i try to run the form it gives as user type not defined why is that?

from within your vb6 ide, goto project and then click references. scroll down within the dialog box that appears and select "Microsoft DAO <version no.> Object Library". click ok to accept.

then save ur project and run it. it will execute properly.

let me know if this helps you.

regards
Shouvik

Your suggestion helped me too!

The library was selected but apparently the order of all the selected library was not good; moving it up in the list solved the problem.

Thanks a lot, I was going crazy!!
Carla

The library was selected but apparently the order of all the selected library was not good; moving it up in the list solved the problem.

you do not need to explicitly order the reference list. whenever u select some references and click ok, visual basic automatically moves up those selected references and ordered them one by one at top of the list which in result helps to identify the libraries used by the current project.

It's very good to hear a good news from you.
Thanks once again...

regards
Shouvik

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.