Microsoft Access 2013 Open form to a specific record not working

I have a form frmaddclient. I need to add a client name, address and other democraphics to  that record. Then I want to allow user to open frmeditclient with additional information.  I open frmaddclient with the add mode. When I just use the wizzard it opens frmeditclient to the first client in the recordset. I wonder if it is not working because some how the database is not recognizing the new record. I use RunCommand acCmdSaveRecord before I try to open the second form. Is there something I am missing. Thanks for the help.
marlind605Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dale FyeCommented:
we would have to see the code that is opening frmAddClient and calling your frmEditClient to be sure.

It sounds like those steps should work correctly.  Normally, instead of :

RunCommand acCmdSaveRecord

I simply set the forms Dirty property to False, and then open the 2nd form

me.dirty = false
strCriteria = "[ClientID] = " & me.clientID
docmd.OpenForm "formname", acNormal, , strCriteria,,acdialog
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Also, there's generally no need to have Add and Edit forms. Just put all the information needed for a specific entity (like your Client) on a single form, and then allow the user to Add or Edit from there.
0
marlind605Author Commented:
I think I see what is going on now. The formname has a recordsource loaded in the form and when I do fyed's suggestion it opens as new. Can I check to see if my frmaddclient is open and if it is filter frmname with that new record close the frmaddclient? Scott, I thought of making certain tabs and controls dissapear if the new record button is selected but this is a new gig for me and not sure how much they will let me change things.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Dale FyeCommented:
Check the DataEntry property of the frmEditClient.  If that property is set to Yes, the form will only open to a new record.
0
marlind605Author Commented:
I changed it to yes and it still comes in as new.
0
Dale FyeCommented:
NO, you don't want it to be Yes, it should be "No".

What code is being used to open frmEditClient?

Can you open that form in design view, then display the data tab of the properties dialog, and take a screen shot of the properties and post that image here so we can see what that looks like?

It would be helpful if you could create a sanitized (no personal or proprietary data) database with these three forms and the associated tables and queries and post it here.  

Make sure you either remove all records or fields that contain phone numbers, addresses, SSN, or any other personally identifiable information.
0
marlind605Author Commented:
The record source on frmname = SELECT * FROM clients WHERE 1=1;  where clients is a table
0
marlind605Author Commented:
The user requested to be able to directly go from the Add New Form, to an Edit form name formEditClient. I put a msgbox and it is picking up the correct new ID.

strCriteria = "Clients_ID = " & Me.Clients_ID
MsgBox strCriteria
DoCmd.OpenForm "FormEditClient", acNormal, , strCriteria, , acDialog
0
Dale FyeCommented:
what is the recordsource for FormEditClient?
0
marlind605Author Commented:
frmeditclient recordsource is record source on frmname = SELECT * FROM clients WHERE 1=1;  where clients is a table
0
Dale FyeCommented:
The WHERE clause is redundant, if you are not going to sort that table , then there is really no need to use the query at all, simply set the RecordSource to : Clients

But that still is not what is causing this problem.  Can you take that screenshot of the Data tab on the properties dialog with FormEditClients open and selected.
0
marlind605Author Commented:
Thanks for the help again. I did not create this database.  Just trying to make improvements the client has requested.
datatab.JPG
0
Dale FyeCommented:
Can you post the entire code you are using to open this form?
0
marlind605Author Commented:
From the form frmaddclient the user fills out the name and the cmdedit button because visible. They will save the record and tblresource is populated with a resource id (No issues here).
When the frmeditclient is selected from the main menu the user will use a search feature that will find the proper record. I have added a myclientid field in the frmeditclient and tried the to open the filter and I get the same results as I do when I use the prior existing tbID field that contains the Client_ID.   Hope this helps.

Dim strCriteria As String
    Call Save_The_Record
   
    Dim rs As DAO.Recordset
        Set rs = CurrentDb.OpenRecordset("tblresource", dbOpenDynaset, dbSeeChanges)
        rs.AddNew
        rs!OLFC_Clients_TL_Client_ID = Me.comboresource
        rs.Update
        rs.Close
     
strCriteria = "tbID = " & Me.Clients_ID
MsgBox strCriteria
DoCmd.OpenForm "Frmeditclient", acNormal, , strCriteria, , acDialog
0
marlind605Author Commented:
Found out there was a command that was calling the previous record on the frmedit form that is what prevented this from working. Thanks for the help
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.