Results 1 to 5 of 5
  1. #1
    spidge32 is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2021
    Posts
    58

    Cannot edit sub form

    Hi I have a small database which has a master form for Jobs and a sub form for activities for each job. To open the sub form a click is required on the Job No and the sub form opens a lists the current activities for that Job.
    I want the user to edit the sub form activities as to the dates, contractors etc. The fields are editable but I cannot edit these fields.


    I have attached the file.
    Thanking you in advance
    Bill
    Attached Files Attached Files

  2. #2
    davegri's Avatar
    davegri is online now Excess Access
    Windows 11 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    Tasman Group Retail Building Services-davegri-v01.zip

    Made a couple of changes. You don't need a table to hold the job code. A Tempvar will do just fine. None of the red needed.
    Code:
    Private Sub jobcode_Click()
    '    Dim wSQL As String
    '    Dim sSQL As String
    '
    '    'Delete OldRecord
    '
    '    DoCmd.SetWarnings False
    '    dSql = "DELETE From JobLineNo"
    '    DoCmd.RunSQL dSql
    '
    '    DoCmd.SetWarnings True
    '
    '
    '    Debug.Print sSQL
    '  ' CurrentDb.Execute sSQL, dbFailOnError
    '
    '   CurrentDb.Execute "INSERT INTO JobLineNo (JobLineNo) VALUES ('" & jobcode & "')"
       
       TempVars!tvjobline = Me.jobcode.Value
       DoCmd.Close acForm, "frmJobList", acSaveYes
       DoCmd.OpenForm "frmJobLineItems", acNormal, "", "", , acNormal
      
    End Sub
    Then the query needs to include the tempvar

    Click image for larger version. 

Name:	qMod.png 
Views:	23 
Size:	41.4 KB 
ID:	48586

    frmJobLineItems should NOT be DataEntry = Yes

    Click image for larger version. 

Name:	formprop.png 
Views:	23 
Size:	18.3 KB 
ID:	48587

    I think that's all I changed. If not, any and all changes in the uploaded DB.

  3. #3
    spidge32 is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2021
    Posts
    58
    Hi,

    Thanks for the information and changes. I have never used tempvars, I will use it in the future.

    Cheers

    Bill

  4. #4
    davegri's Avatar
    davegri is online now Excess Access
    Windows 11 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    Found more problems. qryJobLines, which is the recordsource for frmJobLineItems is editable, but the form is not, because of Locked properties of some of the form's textbox controls.
    In addition, with these controls unlocked, the user has to type in the jobcode (it's the primary key but not an autonumber) and also the Sequence.
    To alleviate some of this requirement, the form setup should be form/subform with table Job Master as the main form and Job Line Items as the subform.
    Ideally JobSeq should be an autonumber, but at this point that would require a pretty large commitment to map and replace the existing FKs in the child table.

  5. #5
    spidge32 is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2021
    Posts
    58
    Hi,

    I will make the changes as you have suggested, The JobSeq comes from the import from the sql database so I left it as imported.

    Thank you for your help

    Cheers Bill

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 01-11-2022, 09:32 PM
  2. Replies: 18
    Last Post: 08-02-2017, 12:56 PM
  3. Replies: 21
    Last Post: 08-05-2013, 06:23 AM
  4. Replies: 1
    Last Post: 05-31-2013, 08:53 AM
  5. Replies: 1
    Last Post: 12-04-2011, 09:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums