Hi Guys,
Trying to figure out what im doing wrong here, I have a value from a record that I want to add to a new entry when a button is pressed... Now ive got the value into variable, and I know its there as I have a messagebox pop up to check, but when I try and insert the value into a new entry it does not populate, but the new entry is created.
Any ideas?
Trying to figure out what im doing wrong here, I have a value from a record that I want to add to a new entry when a button is pressed... Now ive got the value into variable, and I know its there as I have a messagebox pop up to check, but when I try and insert the value into a new entry it does not populate, but the new entry is created.
Code:
Private Sub btn_clsewr_Click()
Dim Blanket_Orders As DAO.Database
Dim rstRequests As DAO.Recordset
Dim rstWR As DAO.Recordset
Dim RepPO
Dim ProType
Set Blanket_Orders = CurrentDb
Set rstRequests = Blanket_Orders.OpenRecordset("Requests")
Set rstWR = Blanket_Orders.OpenRecordset("WR")
'vSql = "SELECT products.[ID] FROM products WHERE products.[ProductName]= '" & Me.ProductName & "';"
'Set rs = Blanket_Orders.OpenRecordset(vSql, dbOpenDynaset, dbSeeChanges)
' Scan the records from beginning to each
While Not rstRequests.EOF
If rstRequests("WRID").Value = Forms![Manage Request].[ID] Then
Set RepPO = rstRequests("ReplacementPO")
Set ProType = rstRequests("ProductID")
' Then update the WRID and Taken values
'rstRequests.Edit
'rstRequests("ReplacementPO").Value = "123456789"
'rstRequests.Update
Dim Response
Response = MsgBox(RepPO, vbYesNo)
rstRequests.AddNew
rstRequests("PO").Value = RepPO
rstRequests.Update
End If
' Move to the next record and continue the same approach
rstRequests.MoveNext
Wend
Any ideas?