I am trying to retrieve records and populate the other fields in a form. I'd type in the requestnumber (pk) in a text field on a form bound to a table tblRequestTable, and it should populate the rest of the fields.
But what this is doing is, it retrieves the record, and when i close it, it saves as a new record, instead of updating.
Code:
strSQL = "Select * FROM RequestTable WHERE RequestNumber = " & Me.txtRequestNum
Set Db = CurrentDb
Set Rs = Db.OpenRecordset(strSQL, dbOpenDynaset)
Rs.MoveFirst
With Rs
Me.txtDateOfRequest = .Fields("DateOfRequest")
Me.txtRequestApproval = .Fields("RequestApproval")
Me.txtDateOfApproval = .Fields("DateOfApproval")
Me.txtDateReserved = .Fields("DateReserved")
Me.StartTime = .Fields("StartTime")
Me.EndTime = .Fields("EndTime")
Me.txtRoomReserved = .Fields("RoomReserved")
Me.txtProgram = .Fields("Program")
End With
Rs.Close
Set Rs = Nothing
please help