tl;dr: Where do I put my code so a macro for a button on the subform can find it, and how can I write go to new record for my subform? Something like
Public Sub newComment()
Forms!frmProjectTracker!frmCommentInputSubform.Set Focus
DoCmd.GoToRecord , , acNewRec
End Sub
but something that works? Thanks ;(
Hey all,
Somewhat new to databases but I have a nicely normalised set of data and subform objects on my main form, which is fine. I'm trying to create a secure comment history, so that a user can input a comment, hit a button, and then it cannot be edited or deleted and it can be viewed via report. I almost have it done in several ways but I am foiled by one thing.
Further explanation at the bottom, but in short, I'd like to know how I'd write a function that goes to a new record in a subform, so I can have a macro which:
saves form
goes to new record in subform (function)
opens my report from the subform table
I'd just like to know where I should write the code, and how to properly reference the subform control to go to a new record.
Thank you so much for any help, I've gone about this in a lot of ways and nothing works as documented below ;(
---
I tried the =ColumnHistory([RecordSource],"Comments","[ID]=" & Nz([ID],0)) method that appears in the sample database 'Sales Pipeline' but it didn't work and I've heard it's not a great method - the functionality is somewhat what I'm after though.
I tried making two tables, one which is linked to fields on the form and gets the input, then a button which runs a macro which appends the data to another table, then deletes it from the input table - so the input table only ever has one record and it's temporary. Then I can report from the history table I appended to. However, it doesn't work well as sometimes on input, the table doesn't take the values, it appends and deletes 0 rows and you have to hit the button again.
What I thought was I could just embed a subform, remove the navigation buttons, and then have macro which goes to the next record and opens the report from that table - that way users have no way of backtracking and editing/deleting and it's somewhat secure (for a group of 5-8 non-tech savvy users).
Public Sub newComment()
Forms!frmProjectTracker!frmCommentInputSubform.Set Focus
DoCmd.GoToRecord , , acNewRec
End Sub
but something that works? Thanks ;(
Hey all,
Somewhat new to databases but I have a nicely normalised set of data and subform objects on my main form, which is fine. I'm trying to create a secure comment history, so that a user can input a comment, hit a button, and then it cannot be edited or deleted and it can be viewed via report. I almost have it done in several ways but I am foiled by one thing.
Further explanation at the bottom, but in short, I'd like to know how I'd write a function that goes to a new record in a subform, so I can have a macro which:
saves form
goes to new record in subform (function)
opens my report from the subform table
I'd just like to know where I should write the code, and how to properly reference the subform control to go to a new record.
Thank you so much for any help, I've gone about this in a lot of ways and nothing works as documented below ;(
---
I tried the =ColumnHistory([RecordSource],"Comments","[ID]=" & Nz([ID],0)) method that appears in the sample database 'Sales Pipeline' but it didn't work and I've heard it's not a great method - the functionality is somewhat what I'm after though.
I tried making two tables, one which is linked to fields on the form and gets the input, then a button which runs a macro which appends the data to another table, then deletes it from the input table - so the input table only ever has one record and it's temporary. Then I can report from the history table I appended to. However, it doesn't work well as sometimes on input, the table doesn't take the values, it appends and deletes 0 rows and you have to hit the button again.
What I thought was I could just embed a subform, remove the navigation buttons, and then have macro which goes to the next record and opens the report from that table - that way users have no way of backtracking and editing/deleting and it's somewhat secure (for a group of 5-8 non-tech savvy users).