Reset Combo Box when fields do not contain data

Joined
May 27, 2006
Messages
1
Reaction score
0
In my database, a form named frmWorkorders uses the select query named qryWorkorders to populate the fields from the table tblWorkorders. The form frmWorkorders has a combo box named bxwostatus that is used to indicate the current status of a workorder as: "In Progress", "Hold", "Shipped" or "Completed".

When "Completed" is chosen, an "On Change" event procedure for the bxwostatus combo box checks to ensure that all fields contain data. If all of the fields contain data, a second form named frmWorkordersComplete opens to show data in the fields that will be appended to a table named tblWorkordersComplete. If any of the fields do not contain data, tblWorkeorders does not open; instead, a msgbox opens stating that the field(s) must contain data before the workorder can be changed to "Completed".

I need to be able to reset the combo box bxwostatus to its previous status (In-Progress, Hold or Shipped) when "Completed" is selected and any of the fields do not contain data. I've tested all of the following in the On Change event subroutine for the combo box bxwostatus box but none work (i.e., the workorder status is indicated as "Complete" regardless if the fields contain data or not):

[frmWorkorders].Form![bxrwostatus].Requery

Me![bxwotstatus].Requery

[bxwotstatus].Requery

Me.Requery

How can I reset the combo box bxwostatus to its previous state when any of the fields do not contain data? Here is the code I use in the on change event for the bxwostatus combo box:
------------------------
Private Sub bxwostatus_Change()
On Error GoTo Err_bxwostatus_Change

' Check Workorder for nulls
If IsNull(wo_shipped) Then
MsgBox "Work Order Recieved Date is required to change this workorder as completed!"
[frmWorkorders].Form![bxrwostatus].Requery
Else
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmWorkordersComplete"
stLinkCriteria = "[ask_id]=" & Me![ask_id]
DoCmd.OpenForm stDocName, , , stLinkCriteria

End If

Exit_bxwostatus_Change:
Exit Sub
Err_bxwostatus_Change:
MsgBox Err.Description
Resume Exit_bxwostatus_Change

End Sub
-------------------------
 
Last edited:

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