Browseto macro, is working from one form but not the other form Where clause isn't working (1 Viewer)

Db-why-not

Registered User.
Local time
Today, 11:25
Joined
Sep 17, 2019
Messages
159
I have a pending list (form) , Completed List (Form ), both of them are using querys to pull the same data from two tables. Each list is filtered for different records, depending on if audit was completed for that record. I am using a browse to macro to navigate to MA_Audit_dataentry form(This form you view 1 record at a time) after the user clicks on the specific lpersonID record/field (highlighted in blue on the list from either the pending list or the completed list. The user is suppose to click the specific lPersonID record they want to navigate to. The navigation is working perfect for both forms, but only Pending list form the correct record opens up though. Completed list, when you click on a specific lpersonID, Example "5" it navigates to the right form just doesn't navigate to lpersonID = 5. It just opens up the first record in that list.

The Where Condition is not working for my Completed list Form, but it is working for my Pending List form.

The macros should be the same for both forms because they are both opening the same form and they are both using the lpersonID to specify what record is opened up on the MA_Audit_Dataentry form. I just don't know why the macro is working on one form but not for the other form. Should the two macros be different for the 2 different forms? If so I'm not sure how I need to write the macro for the Completed list form. Any tips or advice on what is going on with this.
1599670857086.png
 

Attachments

  • list.JPG
    list.JPG
    12.6 KB · Views: 189

theDBguy

I’m here to help
Staff member
Local time
Today, 09:25
Joined
Oct 29, 2018
Messages
21,358
Hi. Just as a troubleshooting step, try adding a MessageBox action to display the IPersonID to see if you're getting what you were expecting.
 

Db-why-not

Registered User.
Local time
Today, 11:25
Joined
Sep 17, 2019
Messages
159
how do you get the lpersonID to display in the messagebox. What is the syntax?
 

Db-why-not

Registered User.
Local time
Today, 11:25
Joined
Sep 17, 2019
Messages
159
lpersonid displayed as expected. I'm wondering if the underlying queries to the form are causing the issue. I have different queries used as the data source depending on who is logged in to the database. But both queries still have lpersonid field in them.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:25
Joined
Oct 29, 2018
Messages
21,358
lpersonid displayed as expected. I'm wondering if the underlying queries to the form are causing the issue. I have different queries used as the data source depending on who is logged in to the database. But both queries still have lpersonid field in them.
Are you able to share a small copy of your db with test data? Otherwise, I am not sure how we can help you troubleshoot it further.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 00:25
Joined
May 7, 2009
Messages
19,169
ADD Tempvars to the Top your Macro:

Code:
SetTempVar
    Name        TVAR_ID
    Expression    =[lPersonID]

on your BrowseTo:
Code:
Where Condition    =[lPersonID] = [TempVars]!TVAR_ID
 

Db-why-not

Registered User.
Local time
Today, 11:25
Joined
Sep 17, 2019
Messages
159
ADD Tempvars to the Top your Macro:

Code:
SetTempVar
    Name        TVAR_ID
    Expression    =[lPersonID]

on your BrowseTo:
Code:
Where Condition    =[lPersonID] = [TempVars]!TVAR_ID
I tried that and it still got the same results.
 

Db-why-not

Registered User.
Local time
Today, 11:25
Joined
Sep 17, 2019
Messages
159
When I tell it to go to one specific record in the where condition it works. It just wont take the lpersonID number from my list that I click on.
 

Db-why-not

Registered User.
Local time
Today, 11:25
Joined
Sep 17, 2019
Messages
159
I finally got it to work. I renamed lpersonID to ID in my query and completed list form.
where condition: ='[lpersonID]=' & [ID]
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:25
Joined
Oct 29, 2018
Messages
21,358
I finally got it to work. I renamed lpersonID to ID in my query and completed list form.
where condition: ='[lpersonID]=' & [ID]
Hi. Congratulations! Glad to hear you got it sorted out. Good luck with your project.
 

vhung

Member
Local time
Today, 09:25
Joined
Jul 8, 2020
Messages
235
The navigation is working perfect for both forms, but only Pending list form the correct record opens up though. Completed list, when you click on a specific lpersonID, Example "5" it navigates to the right form just doesn't navigate to lpersonID = 5. It just opens up the first record in that list.
View attachment 84864
macro is nice to use
>but you could convert that macro command to codes
>just try the codes below

DoCmd.OpenForm "your_form_name_here", acNormal, "", "[ID]=" & [ID], acEdit, acNormal

>i always use these onclick to ID number as hyperlink
 

Users who are viewing this thread

Top Bottom