Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't access or update information

Status
Not open for further replies.

tebza123

Programmer
Dec 1, 2004
3
ZA

I am trying to search and update data on my table but this error appears:No value given for one or more required parameters error number:2147217904

Here is the coding for Search

Set Rcustomer = New Recordset
Rcustomer.Open "SELECT * FROM backups WHERE [Serial_Number]=" & Text1.Text, conn

Text1.Text = Rcustomer![Serial_Number]
Text2.Text = Rcustomer![Brand_Make]
Text3.Text = Rcustomer![Barcode]
Text4.Text = Rcustomer![PC_Location]
Text5.Text = Rcustomer![Customer_name]
Text6.Text = Rcustomer![CustomerTelNo]
Combo1.Text = Rcustomer![Company]
Combo2.Text = Rcustomer![Company_Location]
Combo3.Text = Rcustomer![Technician]
Text7.Text = Rcustomer![Reason]
Text8.Text = Rcustomer![Date_brought_back]
Text9.Text = Rcustomer![Date_out]

MsgBox "Record Found", vbInformation

And for Update:
Set cmdbutton = New ADODB.Command
sql = " Update backups set [Serial_Number]=" & "'" & Text1.Text & "'"

sql = sql & "," & " [Serial_Number]= ' " & Text1.Text & " ' "
sql = sql & "," & " [Brand_Make]=' " & Text2.Text & " ' "
sql = sql & "," & " [Barcode]=' " & Text3.Text & " ' "
sql = sql & " ," & " [Location]= ' " & Text4.Text & " ' "
sql = sql & "," & " [Customer_name]=' " & Text5.Text & " ' "
sql = sql & "," & " [CustomerTelno]=' " & Text6.Text & " ' "
sql = sql & "," & " [Company]=' " & Combo1.Text & " ' "
sql = sql & "," & " [Company_Location]= ' " & Combo2.Text & " ' "
sql = sql & "," & " [Technician]=' " & Combo3.Text & " ' "
sql = sql & "," & " [Reason]=' " & Text7.Text & " ' "
sql = sql & "," & " [Date_brought_back]=' " & Text8.Text & " ' "
sql = sql & "," & " [Date_out]=' " & Text9.Text & " ' "

sql = sql & " where [Serial_Number]=" & Text1.Text
With cmdbutton
.ActiveConnection = cn
.CommandText = sql
.Execute
End With
MsgBox "Record Successfully Updated", vbInformation
Exit Sub

My fields are all text from the table there is no number

Please help me
Thanks


 
I think that your question will be answered in one of the VB related forums. Sorry I don't know VB.

Regards

Steven van Els
SAvanEls@cq-link.sr
 
Check your fields names. Does [Location] need to be [PC_Location]? Is [Serial_Number] a string (varchar)? If so you need to surround it with single quotes all the time.

BTW, for a specific database question you should be in a specific database forum. Try forum709 next time.

zemp
 
That's a connection string error message. Either it can't find a value for the variable "conn" or it is expecting more paramaters after the "conn" variable. I would assume the former rather than the latter. Make sure that you are assigning the connecting string to the variable "conn".

If it isn't that, check in the VB forum.

Denny

--Anything is possible. All it takes is a little research. (Me)

[noevil]
(My very old site)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top