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
Yesterday, 23:45
Joined
Sep 17, 2019
Messages
102
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

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 21:45
Joined
Oct 29, 2018
Messages
11,983
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
Yesterday, 23:45
Joined
Sep 17, 2019
Messages
102
how do you get the lpersonID to display in the messagebox. What is the syntax?
 

Db-why-not

Registered User.
Local time
Yesterday, 23:45
Joined
Sep 17, 2019
Messages
102
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
Yesterday, 21:45
Joined
Oct 29, 2018
Messages
11,983
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

error reading drive A:
Local time
Today, 12:45
Joined
May 7, 2009
Messages
10,315
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
Yesterday, 23:45
Joined
Sep 17, 2019
Messages
102
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
Yesterday, 23:45
Joined
Sep 17, 2019
Messages
102
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
Yesterday, 23:45
Joined
Sep 17, 2019
Messages
102
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
Yesterday, 21:45
Joined
Oct 29, 2018
Messages
11,983
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
Yesterday, 21:45
Joined
Jul 8, 2020
Messages
148
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 (Users: 0, Guests: 1)

Top Bottom