Get a field value from a table directly

krazykaigh

Registered User.
Local time
Today, 00:05
Joined
Apr 10, 2012
Messages
11
Hi all,

I have a subform (sbfm_One let's say) that has a subform on it (sbfm_One_A let's say) that will only be visible if you check a checkbox on the first sbfrm_One.

Now when exiting the control for sbfm_One, if the checkbox is checked and nothing was entered on sbfm_One_A, that's a no no, and sbfm_One_A should become not visible, and the checkbox should return to unchecked, indicating there is no sub data.

Now, the two subforms are related and sbfm_One has a one to many relate with sbfm_One_A.

So on exit, I have to determine if there are any related records in sbfm_One_A if the checkbox is checked. I am trying not to use a query but just a dlookup.

My problem comes when using the Where part and I am trying to get the value of the PK of the underlying table for sbfm_One.

Can someone tell me how to access a table value directly, like:

Dim intNumber as Integer
intNumber = tbl_sbfm_One.["PrimeKey"].value

This way I can use intNumber to see if any records exist in sbfm_One_A's underlying table.

Can the table be directly accessed or do I have to add a field to my form and get the value from that?

Thanks
 
You can't access it like that. You can use DLookup(), or add it to your form if appropriate.
 
@PBaldy:

Thanks, again. I finally just did the hidden field and referenced that. You know what I also realized was that I am using the Main forms. subform control's exit event. So even though it is the subform's info it is checking, I cannot use:
Me.[Name of control on sbfm_One], because me actually refers to the Main form's subform control box, not the subform.

Thanks again!
 

Users who are viewing this thread

Back
Top Bottom