Solved ID link to form not working (1 Viewer)

ANE002

New member
Local time
Today, 05:19
Joined
Aug 24, 2022
Messages
11
maybe this needs separate forums, if so i will gladly make them separate but each issue is connected.

1. I have a split form with an IndexID that is opening the incorrect client form. The same client has the same indexID on the table, query, and split form. However, on the split form when i click the IndexID it asks to enter parameter ID. how do i make it not do that?

2. like wise, when i "enter the parameter ID" it is opening the client form with ID# 335 no mater which ID i actually click on or what i type in the "enter parameter value" box. how do i correct this?

3. same split form, when i try to go into design mode i get a requery error..

pics for references...

1. wrong form opening:
1663876796333.png


2. click on split form ID link:
1663877295292.png

3. requery error
1663877338423.png

1663877351836.png

OnClick Macro:
1663877567530.png
1663877582154.png
 

mike60smart

Registered User.
Local time
Today, 11:19
Joined
Aug 6, 2017
Messages
1,916
Can you upload your database?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 06:19
Joined
Feb 19, 2002
Messages
43,484
Where is the ID link? If you are using a form, this is so much easier with VBA In the click event of a button or the dbl-click event of a textbox.

Docmd.RunCommand acCmdSaveRecord
Docmd.OpenForm "Edit Client Form",,,"ID = " & Me.ID

PS - naming all your PK's ID just leads to confusion and using embedded spaces and special characters in your object names is poor practice.
 

ANE002

New member
Local time
Today, 05:19
Joined
Aug 24, 2022
Messages
11
Where is the ID link? If you are using a form, this is so much easier with VBA In the click event of a button or the dbl-click event of a textbox.

Docmd.RunCommand acCmdSaveRecord
Docmd.OpenForm "Edit Client Form",,,"ID = " & Me.ID

PS - naming all your PK's ID just leads to confusion and using embedded spaces and special characters in your object names is poor practice.
i left the PK as "IndexID" for this client group so that i know which ID i am referring to (i have a client group, employee group, and a ticketing group and each have their own table, query, and forms all with their own ID names). There shouldnt be any embedded spaces or special characters in any of them. Im very new to Access and self learning through YouTube. If you see one i missed in what was posted please let me know so i can correct it.

since this was originally posted i have since removed the macro and switched to the VBA you suggested. This resolved all of the issues listed but did present a new one. Now when i click the IndexID it does open the correct form but its blank when it should be opening the record for the IndexID clicked.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 06:19
Joined
Feb 19, 2002
Messages
43,484
Welcome. If you want us to debug code for you, you will need to post it:) We're good but not prescient. Did you look at my suggested code? The form's name in the macro was "Edit Client Form". Looks like embedded spaces to me.

Please post your Open form code and we'll look at it.
 

ANE002

New member
Local time
Today, 05:19
Joined
Aug 24, 2022
Messages
11
Welcome. If you want us to debug code for you, you will need to post it:) We're good but not prescient. Did you look at my suggested code? The form's name in the macro was "Edit Client Form". Looks like embedded spaces to me.

Please post your Open form code and we'll look at it.
I attached my file. Hopefully you can view it. This orginally started off as the Access blank template for Call Tracking. Overall it suits our needs with a few tweaks. Ive slowly been self learning all the connections, expressions, relationships, formatting, etc so feel free to let me know what i need to correct so i can get it right next time.

the main focus right now is... on the menu when you click on the command button for "Client List" it will open the split form. from there the user should be able to click the ID to open that records form. currently that piece is working. identical process for the "All Employees" button. that also is working. identical process for the "All tickets" button and this one is NOT working. as far as i can see all settings, naming conventions, spelling, and formatting are the same yet this one is not working.

similarly the "Edit Service Ticket" button will only open to a blank form where it should be opening to the service tickets. look at the Edit Client and Edit Employee buttons, when the forms open you can scroll through all records but not with the Edit Service Tickets button.
 

Attachments

  • Client Service Attempt 2.accdb
    5.3 MB · Views: 235

mike60smart

Registered User.
Local time
Today, 11:19
Joined
Aug 6, 2017
Messages
1,916
Hi

See the attached.

The On Click of the ID Control now opens the Form "Edit Service Ticket" and displays the selected Record.

The fault was down to the properties of the Form.
On the Data Tab of this Form I changed Data Entry to NO vice Yes.

The problem with using these Templates offered by Microsoft is that there are numerous issues with them.

You should not be using Lookup Fields in Tables
You should not be using Spaces in Field Names
You should have a meaningful name for the Autonumber field in each Table. Use a name vice using just ID as this can lead
to confusion.
 

Attachments

  • Client Service Attempt 2.zip
    402.2 KB · Views: 81
Last edited:

ANE002

New member
Local time
Today, 05:19
Joined
Aug 24, 2022
Messages
11
Hi

See the attached.

The On Click of the ID Control now opens the Form "Edit Service Ticket" and displays the selected Record.

The fault was down to the properties of the Form.
On the Data Tab of this Form I changed Data Entry to NO vice Yes.

The problem with using these Templates offered by Microsoft is that that are numerous issues with them

You should not be using Lookup Fields in Tables
You should not be using Spaces in Field Names
You should have a meaningful name for the Autonumber field in each Table. Use a name vice using just ID as this can lead
to confusion.
THANK YOU THANK YOU THANK YOU!! I will go through and make as many of these updates as i can catch.
 

Users who are viewing this thread

Top Bottom