i need a code to enter data into a textbox and update an access database table which must be displayed in my listbox, please help
i also want to know hoe to search data in the table

Recommended Answers

All 5 Replies

to enter a data in textbox:
place a command button and data object and connect the database write code in command button.
"data1.recordset.addnew"
this code save data in the database.
data1.refresh
it update data.
connect the listbox with database. for search data write this code:


Dim Searchit As String
Dim Founder As Boolean

Searchit = UCase(InputBox("Enter name:", "Edit"))
If Len(Searchit) > 0 Then
'add this line
Data1.Refresh
Data1.Recordset.MoveFirst
Founded = False
End If

Do While (Not Founder) And (Not Data1.Recordset.EOF)
'u can add UCASE i just removed it for my query
If UCase(Data1.Recordset.Fields("name").Value) = Searchit Then
Founder = True
Exit Sub
End If
Data1.Recordset.MoveNext
Loop

If Not Founder Then
MsgBox "Unable to find the required item", , "Not Found"
Data1.Recordset.MoveLast
End If

i need the code for vb6

all this code is for vb6.

>all this code is for vb6. and the DAODC AKA Data1

Use the data form wizard, of which you will find under add-ins>add-in manager. Start a new standard exe project and then run the wizard as many times as necessary so that you have selected each form type and use each class/code/control. Save this as an example project and modify form1 to startup the other forms and that way you can walk through the code of each form type with F8.


Good Luck

i m not able to update my data using below program ....
please check and do needfull for me.....

Private Sub Command1_Click()
Data1.Recordset.AddNew
End Sub

Private Sub Command2_Click()
Data1.Recordset.Update
End Sub

Private Sub Command3_Click()
Data1.Recordset.Edit
End Sub

Private Sub Command4_Click()
Data1.Recordset.Delete
Text1.Text = ""
Text2.Text = ""
Data1.Refresh
End Sub

Private Sub Command5_Click()
Data1.RecordSource = " Table1"
Data1.Refresh
End Sub

Private Sub Command6_Click()
End
End Sub

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.