Referencing a Checkbox in a different table... (1 Viewer)

Lucas79

Registered User.
Local time
Today, 06:00
Joined
Aug 22, 2015
Messages
14
Hi All,

I'm using Access Web App within Office 365 and I'm trying to check if a checkbox is selected when a specific customer is selected on a form.

Here's my situation:

Table1: Basic customer info, including a checkbox if the customer is 'blocked' or not.

Table2: Different locations for customers.

If one of my users goes to the Locations view/form and selects a location of a customer that is 'blocked' I want it to give a MessageBox. This works perfectly on Table1, but on Table2 it gives a Macro error.

Here is the code I use on the form for Table2:

---

If [CustomerData].[BlockedYes_or_No]=1 then
MessageBox "Some text goes here"
End if

---

In this case CustomerData=Table1 in my explanations

Can someone please explain what is the right way to reference a different table then the one the form is based on?

Thanks in advance and kind regards,

Lucas
 

Ranman256

Well-known member
Local time
Today, 00:00
Joined
Apr 9, 2015
Messages
4,337
give the FULL path to the form object,

if forms!CustomerData!chkBox.value = 1 then
endif
 

Lucas79

Registered User.
Local time
Today, 06:00
Joined
Aug 22, 2015
Messages
14
Hi Ranman256,

Thank you for your quick reply. Your solution looks logical, but doesn't seem to work in Access Web App on Office 365, or I'm doing something wrong.

When I use the "!" after 'forms' Access gives the following error:

"The expression you entered uses a function that is not valid in the given context"

If I replace the "!" with a "." there is no error in Access, but I get exactly the same error in the Web App as before.

Any further help would be greatly appreciated.

Kind regards,

Lucas
 

Lucas79

Registered User.
Local time
Today, 06:00
Joined
Aug 22, 2015
Messages
14
Never mind, the solution, as most of the times, was very easy.

It appears you can just drag the needed control form other related tables. In my case the Checkbox. It is 'greyed out' in the Web App so you can't edit it on the form where you dragged it too, but in this case all I need is to check whether the specified customer is 'blocked' or not.

Thanks again for you quick reply. I'll leave this here in case other members find this information usefull.
 

Users who are viewing this thread

Top Bottom