Need help Please

9

987654

Hi there,
I have a form. When you select the name from a combo box it checks the warehouse and divisoin associated with that name, and populates the next 2 combo boxes accordingly ( based on the matching field in tblpayrates ).
I want the uset to be able to change the division and / or warehouse to any others, and then hit the process button to change the information in the table.
I am using the follwing statement, the issue with it is, it is populating only one of the fields in the table, and it is giving it a numeric value, not the one I selected in the combo box. please help ?
Dim newwarehouse
Dim newdivision
Dim strsql As String
Me.cmbWarehouse.SetFocus
newwarehouse = Me.cmbWarehouse.Text
Me.cmbDivision.SetFocus
newdivision = Me.cmbDivision.Text
strsql = ("update [tblpayrates] set [luwwarehouse]= '" & newwarehouse & "' and [luwdivision]= '" & newdivision & "' where [txtname] = '" & Me.txtName & "'")
CurrentProject.Connection.Execute (strsql)
MsgBox ("SUCCESS! " & vbCrLf & _
username & " has Successfully set " & Me.txtName & vbCrLf & _
"To Warehouse: " & newwarehouse & vbCrLf & _
"And Division is now: " & newdivision)
Me.txtName = ""
Me.cmbWarehouse = ""
Me.cmbDivision = ""
Exit Sub
Err_cmd3_click:
MsgBox "An Error Has Occured with the following information :" & vbCrLf & _
"Error Number: " & Err.Number & vbCrLf & _
"Error Description: " & Err.Description
Resume Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top