J
Joan
I have been trying to update a field in a table not in the record source of
my form. My form (CreditMemo) has a button that records the [Returned] ( Y
or N), [ReturnedComment] and [ReturnedDate] in the Sales table via an update
query for a dog that has been returned by the customer. This results in the
dog being added back to inventory (SalesScreen). However, in order that
salesmen who view the SalesScreen know whether a dog is available for sale
or not, the [Store] data from the first sale must be taken out of the
[Store] control. If the Store field is blank, the salemen then know that
the dog is available for sale. If the Store field is filled in, the dogs
has been sold but not invoice or shipped yet (then the DateSold field is
filled in at invoicing time). Please can anyone tell me why my code below,
is not taking the data out of the Store field and leaving it blank. When I
run the code, the Store field information is still in the control.
Joan
Dim stQueryName As String
Dim db As Database
Dim rs As DAO.Recordset
Dim strOldStore As String
Dim strNewStore As String
Me.Recalc
stQueryName = "qryReturned"
DoCmd.SetWarnings False
DoCmd.OpenQuery stQueryName, acViewNormal, acEdit
DoCmd.SetWarnings True
Set db = CurrentDb
Set rs = db.OpenRecordset("Dogs")
'Store original data
strOldStore = rs!Store
'Get new data ("") for record. Make [Store] empty on SalesScreen for
returned dog.
strNewStore = ""
With rs
.Edit
!Store = strNewStore
.Update
.Bookmark = .LastModified
End With
rs.Close
db.Close
End Sub
my form. My form (CreditMemo) has a button that records the [Returned] ( Y
or N), [ReturnedComment] and [ReturnedDate] in the Sales table via an update
query for a dog that has been returned by the customer. This results in the
dog being added back to inventory (SalesScreen). However, in order that
salesmen who view the SalesScreen know whether a dog is available for sale
or not, the [Store] data from the first sale must be taken out of the
[Store] control. If the Store field is blank, the salemen then know that
the dog is available for sale. If the Store field is filled in, the dogs
has been sold but not invoice or shipped yet (then the DateSold field is
filled in at invoicing time). Please can anyone tell me why my code below,
is not taking the data out of the Store field and leaving it blank. When I
run the code, the Store field information is still in the control.
Joan
Dim stQueryName As String
Dim db As Database
Dim rs As DAO.Recordset
Dim strOldStore As String
Dim strNewStore As String
Me.Recalc
stQueryName = "qryReturned"
DoCmd.SetWarnings False
DoCmd.OpenQuery stQueryName, acViewNormal, acEdit
DoCmd.SetWarnings True
Set db = CurrentDb
Set rs = db.OpenRecordset("Dogs")
'Store original data
strOldStore = rs!Store
'Get new data ("") for record. Make [Store] empty on SalesScreen for
returned dog.
strNewStore = ""
With rs
.Edit
!Store = strNewStore
.Update
.Bookmark = .LastModified
End With
rs.Close
db.Close
End Sub