Search Code From Data Base

Amitdas

New Member
Joined
Apr 27, 2019
Messages
22
Hi, I am as new in VBA to Know about a set of code where i can get a Specific information from my data base. E.g If i enter a some of data to used a form and if i missed something or wish to amend some of incorrect data to correct in data base. How can i do this. I am using below code but not work. Can you plz help me to solved this issue.
Thanks in advance.

(N.B : Underline code is saying an error.)


Private Sub CommandButton4_Click()
Dim x As Long
Dim y As Long
x = Sheets("Sheet1").Range("a" & Rows.Count).End(xlUp).Row

For y = 2 To x
If Sheets("Sheet1").Cells(y, 2).Text = TextBox6.Value Then
TextBox1.Text = Sheets("Sheet1").Cells(y, 3)
TextBox1.Text = Sheets("Sheet1").Cells(y, 4)
TextBox1.Text = Sheets("Sheet1").Cells(y, 7)
TextBox1.Text = Sheets("Sheet1").Cells(y, 8)
TextBox1.Text = Sheets("Sheet1").Cells(y, 9)
ComboBox1.Text = Sheets("Sheet1").Cells(y, 5)
ComboBox2.Text = Sheets("Sheet1").Cells(y, 6)
End If
Next y

End Sub
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Assuming the error is a 1004 User or Object defined error.
the line of code works for me without error. Check to make sure you don't have another character on that line somewhere. You can probably fix it by deleting the entire line of code and retyping it back in.

E.g If i enter a some of data to used a form and if i missed something or wish to amend some of incorrect data to correct in data base. How can i do this.
You need to give an example of what you want to do here. The question is very broad in scope and there could be multiple ways to do what you ask in the way it is stated here.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top