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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

where clause on a form not letting me save data

Status
Not open for further replies.

grmman

MIS
Sep 9, 2003
81
US
I open a form with a where clause. it works fine,
I use the same form to view/edit the data. I also let the use to add new records on the same form.But when I go and try to save the new record I get an runtime error 30014.
Thanks for any help


 
How are ya grmman . . . . .

The [blue]Where Clause[/blue] just determines what records you can view in the form, and has nothing to do with the problem!
grmman said:
[blue]But when I go and try to save the new record I get an runtime error 30014.[/blue]
And just how are you trying to save the record?

Post the code for this . . . . .

Calvin.gif
See Ya! . . . . . .
 
This is not an error, just a warning saying to you that the data are added to the database but not displayed in the form due to the underlaying query criterias.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Is There a way I can get the data to display in the current form, or do I have to close the form and reopen it after I save the data.
Thanks
 
grmman . . . . .

If the saved record passes crireria as set . . . yes.

[blue]Me.[purple]Requery[/purple] should do.[/blue]

Calvin.gif
See Ya! . . . . . .
 
how do I not show the messaage when I am saving.
here is my save code
Code:
Private Sub cmdsave_Click()
Dim strvisitid As Integer

On Error GoTo Err_cmdsave_Click
    If (newflag) Then
        Let strvisitid = GetId(enumVisit)
        Let Me.visit_id = strvisitid
        Me.ServerFilter = ""
        Me.Filter = ""
    End If
    'Call DoCmd.RunCommand(acCmdSaveRecord)
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    DoCmd.Close
    
Exit_cmdsave_Click:
    Exit Sub

Err_cmdsave_Click:
If (Err.Number <> "30014") Then
        MsgBox Err.Description
Else
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    DoCmd.Close
        
End If
    Resume Exit_cmdsave_Click
   
End Sub
 
I fixed the problem.
I changed:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
to be docmd.save
and it works great now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top