| | |
Need help
![]() |
•
•
Join Date: Jun 2005
Posts: 4
Reputation:
Solved Threads: 1
hello,
you can use the seek command that will allow you to search for a certain value of data inside your database.
but do not worry i will post you a full code description next time.
.
but i just wanna give an advise :
try to use much more meanfull names for your items, for example :
CmdExit for your Exit button instead of command3 and CndSave for your Save Button instead of command2. because once your project gets bigger and bigger it will be much more easier to follow up when using meanfull names.
got the idea?
you can use the seek command that will allow you to search for a certain value of data inside your database.
but do not worry i will post you a full code description next time.
.but i just wanna give an advise :
try to use much more meanfull names for your items, for example :
CmdExit for your Exit button instead of command3 and CndSave for your Save Button instead of command2. because once your project gets bigger and bigger it will be much more easier to follow up when using meanfull names.
got the idea?
•
•
Join Date: Jun 2005
Posts: 4
Reputation:
Solved Threads: 1
ok as i promised you here it is.
Data1.Recordset.MoveFirst
Do Until Data1.Recordset.EOF
If Data1.Recordset!Name = datatofind Then
Data1.Recordset.Delete
Data1.Refresh
Exit Do
End If
Data1.Recordset.MoveNext
Loop
where "datatofind" is a varaible that contains the data you wanna delete.
"data1" is your data object that is connected to the database.
"Name" is the field you are proccessing.
you can use the same code to display search results by replacing Data1.Recordset.Delete
by the appropriate lines of code.
and another thing:
inatead of doing this:
Public Sub cleaall()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Image1.Picture = LoadPicture("")
Frame1.Enabled = False
Command1.SetFocus
End Sub
try that:
Public Sub cleaall()
For Each ctl In Controls
If TypeOf ctl Is TextBox Then
ctl.Text = ""
End If
Next ctl
Image1.Picture = LoadPicture("")
Frame1.Enabled = False
Command1.SetFocus
End Sub
i hope this helps
Data1.Recordset.MoveFirst
Do Until Data1.Recordset.EOF
If Data1.Recordset!Name = datatofind Then
Data1.Recordset.Delete
Data1.Refresh
Exit Do
End If
Data1.Recordset.MoveNext
Loop
where "datatofind" is a varaible that contains the data you wanna delete.
"data1" is your data object that is connected to the database.
"Name" is the field you are proccessing.
you can use the same code to display search results by replacing Data1.Recordset.Delete
by the appropriate lines of code.
and another thing:
inatead of doing this:
Public Sub cleaall()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Image1.Picture = LoadPicture("")
Frame1.Enabled = False
Command1.SetFocus
End Sub
try that:
Public Sub cleaall()
For Each ctl In Controls
If TypeOf ctl Is TextBox Then
ctl.Text = ""
End If
Next ctl
Image1.Picture = LoadPicture("")
Frame1.Enabled = False
Command1.SetFocus
End Sub
i hope this helps
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Argument Not Optional message in VB
- Next Thread: Macros
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





