Hi,
I have a form called "InvoiceForm" - on this form are two subforms called "NewPurchaseTable" and "TheirPurchaseTableQuery".
Below is a screenshot of how "InvoiceForm" looks:
I have blanked out other columns that are irrelevant to this problem to avoid confusion.
What I am trying to do is match the entries in both subforms. If the selected record's [Duplicate ID] from the left subform matches the selected record's [OurOrderID] from the right subform, and the Prices match as well, then I want to copy the [PurchaseID] into the [Invoice ID] field.
Before I attempt to copy the [PurchaseID] into the [Invoice ID] field, I am trying to make sure the selected records are correct, and here lies the problem...
First of all I tried various versions of the following code:
However this code always resulted in an "Incorrect" message. I then created 3 text boxes (at the top of the screenshot) called "Test1", "Test2" and "Result". "Test1" shows the [Duplicate ID] of the selected record, and "test2" shows the [OurOrderID] of the selected record. The screenshot below shows the code used to populate the text boxes, and if you look at the first screenshot you can see it works properly.
I tried the following code, and various variations, to try and compare these two values:
However this also results in an "incorrect" message every time, could anyone please help me with the code to check these records
I know that my intention to copy and "duplicate" data is breaking normalization rules, however it is necessary to do it in this manner. a simple yes/no check box to say if the invoices are correct will not suffice as I need to be able to see exactly which ones are matched, as occassionally our suppliers mess up and charge us twice on the same invoice number.
Any help would be welcomed. Thank you for your time.
Dean.
I have a form called "InvoiceForm" - on this form are two subforms called "NewPurchaseTable" and "TheirPurchaseTableQuery".
Below is a screenshot of how "InvoiceForm" looks:
I have blanked out other columns that are irrelevant to this problem to avoid confusion.
What I am trying to do is match the entries in both subforms. If the selected record's [Duplicate ID] from the left subform matches the selected record's [OurOrderID] from the right subform, and the Prices match as well, then I want to copy the [PurchaseID] into the [Invoice ID] field.
Before I attempt to copy the [PurchaseID] into the [Invoice ID] field, I am trying to make sure the selected records are correct, and here lies the problem...
First of all I tried various versions of the following code:
Code:
If Forms!InvoiceForm!NewPurchaseTable.Form.[Duplicate ID] = Forms!InvoiceForm!TheirPurchaseTableQuery.Form.[OurOrderID] then
msgbox "Correct"
else
msgbox "Incorrect"
End if
However this code always resulted in an "Incorrect" message. I then created 3 text boxes (at the top of the screenshot) called "Test1", "Test2" and "Result". "Test1" shows the [Duplicate ID] of the selected record, and "test2" shows the [OurOrderID] of the selected record. The screenshot below shows the code used to populate the text boxes, and if you look at the first screenshot you can see it works properly.
I tried the following code, and various variations, to try and compare these two values:
Code:
If test1 = test2 then
msgbox "Correct"
else
msgbox "Incorrect"
End if
However this also results in an "incorrect" message every time, could anyone please help me with the code to check these records
I know that my intention to copy and "duplicate" data is breaking normalization rules, however it is necessary to do it in this manner. a simple yes/no check box to say if the invoices are correct will not suffice as I need to be able to see exactly which ones are matched, as occassionally our suppliers mess up and charge us twice on the same invoice number.
Any help would be welcomed. Thank you for your time.
Dean.