Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query conflict - throws error on update form

Status
Not open for further replies.

jazminecat23

Programmer
Mar 16, 2007
103
US
Hi all -

I have a form in an adp, based on a view (query). The form loads fine. The view pulls all records from my table where the status = 0, which are those records where the vendor number <1.

On the form, the user will be entering a vendor number. When the user enters the vendor number, it changes the status to 1.

That works, but the form throws me an error when I go to the next record: "The data was added to the database but the data won't be displayed in the form because it doesn't satisfy the criteria in the underlying record source."

So I'm guessing that this is because the query is based on status = 0, and when they update the item, the status = 1.

How do I get around this? I only want to display those record with status of 0, since this db exists primarily to receive vendor number requests? I tried changing the query to show records where the vendor number is less than 1, but I get the same issue. They query behind the form throws me an error if I change the record to conflict with the query.

Here's the code on the form:

Code:
Option Compare Database


Private Sub PrintRecord_Click()
On Error GoTo Err_PrintRecord_Click

    Dim stDocName As String
    stDocName = "VendorRequestReport"
    DoCmd.OpenReport stDocName, acViewPreview, , "[ID]=" & Forms![Open Vendor Number Requests].ID
    
Exit_PrintRecord_Click:
    Exit Sub

Err_PrintRecord_Click:
    MsgBox Err.Description
    Resume Exit_PrintRecord_Click
    
End Sub

Private Sub VENDOR_NUM_LostFocus()
   If Me.VENDOR_NUM > 0 Then
    Me.STATUS = "1"
    Me.Status2 = "Done"
    Else
    Me.STATUS = "0"
    Me.Status2 = "New"
    End If
    DoCmd.Save
    
    

End Sub

Thanks in advance to anyone who can help me. This is an access 2000 .adp.

 
If you are just looking to suppress the warning message, you could try:

Code:
Private Sub VENDOR_NUM_LostFocus()
[blue][b]DoCmd.SetWarnings False[/b][/blue]
If Me.VENDOR_NUM > 0 Then
    Me.STATUS = "1"
    Me.Status2 = "Done"
Else
    Me.STATUS = "0"
    Me.Status2 = "New"
End If
DoCmd.Save
[blue][b]DoCmd.SetWarnings True[/b][/blue]
    
End Sub


-V
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top