Can't find matching fields

stevemccauley

Registered User.
Local time
Today, 16:58
Joined
Aug 8, 2001
Messages
75
I have 2 tables that are connected with a one-to-many relationship( Table A, Table B). When I go to enter data into the 'Table B' Form I get a message "can't find record in table "Table A" with matching field "Table B"". What type of code do I have to enter to get access to understand that when the Table B Form is opened through the Table A Form, access should copy the Table A AutoNumber onto Table B.
 
Assuming that the relevant control is named txtIDNumber on both forms, in the BeforeUpdate event procedure for the Table B form, put the following code:

If IsNull(Me!txtIDNumber) Then
Me!txtIDNumber = [Forms]![Table A Form]![txtIDNumber]
End If
 
Error Message

I tried the code you gave me, but I got an Error message.

Method 'Item' of objet 'Forms' failed

What does this mean?
 
Check to be sure that you didn't change an exclamation point to a period. If you refer to

[Forms]![MyForm]![Item]

Access assumes that Item is a control on the form MyForm, but if you refer to

[Forms]![MyForm].[Item]

Access assumes that Item is a method or property of MyForm, which might generate the error you received.

Also, make sure that you are spelling the names of all forms, controls and other objects correctly, as any misspelling will cause the code to be misinterpreted and may generate all sorts of unexpected errors.
 
Thanks, its working now.

The problem was that I renamed a column in my table but didn't change the name on the form.
 

Users who are viewing this thread

Back
Top Bottom