Results 1 to 3 of 3
  1. #1
    Join Date
    May 2005
    Posts
    1,191

    Unanswered: Create New Record

    I have a form with information on it, and when a button is clicked, I want it to load the information into a new record in a table in the database. Maybe I've just been staring at it too long, but can anyone tell me why this won't work? Besides the fact that I'm being stupid right now?
    PHP Code:
    Dim dbsEWORF As Database
    Set dbsEWORF 
    OpenDatabase("EWORF Db.mdb")
    Dim rstTable As Recordset
    Set rstTable 
    dbsEWORF.OpenRecordset("Tbl_EWORF"dbOpenDynaset)
    With rstTable
        
    .AddNew
        
    !Fld_EWORF_PrimKey Forms!Frm_ReqNew!Fld_EWORF_PrimKey
        
    !Fld_EWORF_Person_Req Forms!Frm_ReqNew!Fld_EWORF_Person_Req
        
    !Fld_EWORF_Date_Start Forms!Frm_ReqNew!Fld_EWORF_Date_Start
        
    !Fld_EWORF_Eng_Proj_No Forms!Frm_ReqNewFld_EWORF_Eng_Proj_No
        
    !Fld_EWORF_Cust_Ord_No Forms!Frm_ReqNew!Fld_EWORF_Cust_Ord_No
        
    !Fld_EWORF_GL_Acc_Code Forms!Frm_ReqNew!Fld_EWORF_GL_Acc_Code
        
    !Fld_EWORF_Proj_Desc Forms!Frm_ReqNew.Controls!Fld_EWORF_Proj_Desc
        
    .Update
    End With 
    Thank you to anyone who can offer help.
    Me.Geek = True

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    this
    !Fld_EWORF_Eng_Proj_No = Forms!Frm_ReqNewFld_EWORF_Eng_Proj_No
    is a typo

    where is this code running?
    in frm_ReqNew?
    if yes:

    Dim dbsEWORF As DAO.Database
    Set dbsEWORF = OpenDatabase("EWORF Db.mdb")
    Dim rstTable As DAO.Recordset
    Set rstTable = dbsEWORF.OpenRecordset("Tbl_EWORF", dbOpenDynaset)
    With rstTable
    .AddNew
    !Fld_EWORF_PrimKey = me.Fld_EWORF_PrimKey
    !Fld_EWORF_Person_Req = me.Fld_EWORF_Person_Req
    !Fld_EWORF_Date_Start = me.Fld_EWORF_Date_Start
    !Fld_EWORF_Eng_Proj_No = me.Fld_EWORF_Eng_Proj_No
    !Fld_EWORF_Cust_Ord_No = me.Fld_EWORF_Cust_Ord_No
    !Fld_EWORF_GL_Acc_Code = me.Fld_EWORF_GL_Acc_Code
    !Fld_EWORF_Proj_Desc = me.Fld_EWORF_Proj_Desc
    .Update
    End With

    izy
    currently using SS 2008R2

  3. #3
    Join Date
    May 2005
    Posts
    1,191
    Thanks Izy, that did it.
    Me.Geek = True

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •