accessnoobhelp
New member
- Local time
- Today, 18:11
- Joined
- Jan 9, 2018
- Messages
- 7
Hello, this is my first post so I hope I don't break any rules. I do not have a tech background, but I am using an Access database and I need help. I bought a database that was already set up with access to the full source code. It is for keeping client records at a small nonprofit.
There is first a form for a list of all persons, which lists their names and a "person ID" that is assigned (via autocount) when I create a new client.
When I create a new client, it opens up a blank "Person" form, which is for the "Person" table. There is no issue with this form.
However, when I am looking at the "persons" form, I can press "Detail" beside the person ID. It should bring up the same form for a new client, except that it pulls the filled-in form for this person. They are connected with the person ID.
I moved some things around in both of those forms, and deleted some unnecessary fields, but didn't mess with any code at all. I very stupidly did not save a backup, and due to the grief this issue is causing me, will never make that mistake again.
However, after editing these forms, the "detail" button is broken (for lack of a better term). Instead of pulling up the "person" form with the specific person ID and their filled-in form, it brings up a blank form.
This is the VBA code for the cmdDetail button:
Private Sub cmdDetail_Click()
On Error GoTo Err_cmdDetail_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Person"
stLinkCriteria = "[Person ID]=" & Me![Person ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdDetail_Click:
Exit Sub
Err_cmdDetail_Click:
MsgBox Err.Description
Resume Exit_cmdDetail_Click
End Sub
---
Is there something wrong with this code? I have tried to create a new button and it does the same thing. I admittedly have little idea what I'm doing, but I follow directions well and can answer more questions that help someone give me a direction to go in. Thanks in advance for any help.
There is first a form for a list of all persons, which lists their names and a "person ID" that is assigned (via autocount) when I create a new client.
When I create a new client, it opens up a blank "Person" form, which is for the "Person" table. There is no issue with this form.
However, when I am looking at the "persons" form, I can press "Detail" beside the person ID. It should bring up the same form for a new client, except that it pulls the filled-in form for this person. They are connected with the person ID.
I moved some things around in both of those forms, and deleted some unnecessary fields, but didn't mess with any code at all. I very stupidly did not save a backup, and due to the grief this issue is causing me, will never make that mistake again.
However, after editing these forms, the "detail" button is broken (for lack of a better term). Instead of pulling up the "person" form with the specific person ID and their filled-in form, it brings up a blank form.
This is the VBA code for the cmdDetail button:
Private Sub cmdDetail_Click()
On Error GoTo Err_cmdDetail_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Person"
stLinkCriteria = "[Person ID]=" & Me![Person ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdDetail_Click:
Exit Sub
Err_cmdDetail_Click:
MsgBox Err.Description
Resume Exit_cmdDetail_Click
End Sub
---
Is there something wrong with this code? I have tried to create a new button and it does the same thing. I admittedly have little idea what I'm doing, but I follow directions well and can answer more questions that help someone give me a direction to go in. Thanks in advance for any help.