comparing from a subform... (1 Viewer)

QMDirk

Member
Local time
Today, 13:20
Joined
Nov 16, 2019
Messages
52
This should be easier, but I'm in a panic and under pressure (lol). I have a form with a subform. The user will enter a number on the subform and I want to compare the User's entry with a number on the main form. If it matters, the number on the main form is displayed using the DLookUp function to get the component number from a Master Table. However, there is also a 2nd subform on the main form that displays data directly from the Master Form that I am seeking. Here are the names:

Main Form: FDL4 Control with DLookup value is named: MICAN2
SubForm 1: FDstL4 Control where data is entered is named: Can Number
SubForm 2: FDMIL4 Control that contains the Master Table value is named: MI CAN
the data is being entered using a handheld barcode scanner so I want the screen to throw up an error and halt the entry if the entered data does not match the value in the Master Table.

Any takers? Thanks.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:20
Joined
Oct 29, 2018
Messages
21,454
Hi. I am thinking you would use the Control's BeforeUpdate event to check the value against the main form. You should be able to reference the control on the main either by using an absolute reference (Forms!...) or a relative reference (Me....).

Hope that helps...
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 21:20
Joined
Jul 9, 2003
Messages
16,272
the data is being entered using a handheld barcode scanner so I want the screen to throw up an error and halt the entry if the entered data does not match the value in the Master Table.

In Situations like this, I usually use an unbound textbox to gather the barcode scan. Then feed the scanned number/text from he textbox into a query which returns the number of matching records in the table. Once you've got the query working, you can feed a text version of the query into this function:- "fProcessSQL" found Here:-


The function will return, 0 1 or 2 ..... Use the return values to control what happens next.
 

Users who are viewing this thread

Top Bottom