troubleshooting Question

msaccess newrecord failure

Avatar of Jacques Weissenburger
Jacques WeissenburgerFlag for France asked on
Microsoft Access
28 Comments1 Solution180 ViewsLast Modified:
Hi,

I need your help.
I builded a DB with an identification form.. to select an ID called Ref_ID
With that ID I open a second form (Data_Form) related to a table with the ID variable as a primary key

For each ID I record several data through Two subforms of that Data_Form

Everything works fine, except that I cannot create a new record  with that Data_Form. I use the conventional code

Private Sub New_Record_Click()
Dim CodePatient As Long
On Error GoTo Err_New_Record_Click


     CodePatient = Me.Réf_Patient    'This one is OK
     Me.Requery

    DoCmd.GoToRecord , , acNewRec
   
   
    Me.Réf_Patient = CodePatient   'this one produces an error  after execution Me.ré_Patient is NULL
    NewRecordFlag = True
    ChangeLockForm (True)
   

    Me.[_SubFormA].Requery
    Me.[_SubFormB].Requery

   
Exit_New_Record_Click:
    Exit Sub

Err_New_Record_Click:
    MsgBox Err.Description
    Resume Exit_New_Record_Click
   
End Sub


Must be something trivial or related to a property oy the form, I didn't set correctly..

Thanks for any help

Jacques
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 28 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 28 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros