0
votes

The first form table that you can see is translating data from a query.

enter image description here

On the click of the button to the left side of the table, the code is as follows;

Private Sub btnProductInfo_Click()
On Error GoTo Err_mySUB
'---------------------'

        Dim LintelID As String

        LintelID = DLookup("ID", "ImportProductAndTypes", "No =" & ItemNo)

         'DoCmd.OpenForm "MAINProductInformation", , , "NoCode =" & Chr(34) & Me.ItemNo & Chr(34), acFormEdit

'---------------------'
Exit_mySUB:
    Exit Sub
Err_mySUB:
    MsgBox Err.Number & ": " & Err.Description & " (" & Erl & ")"
    Resume Exit_mySUB
End Sub

I started off with the DoCmd.OpenForm function first which takes the text value of the ItemNo (Item Code) column of the query and then is supposed to open the form "MAINProductInformation" on the record which uses the code of the one referenced.

This was not working as expected so I decided to add an ID column to the table "ImportProductAndTypes" in which the form being opened would need to reference to go to the record. What I was finding is that for whatever reason the item is not being found within the table even though the value is in there...

enter image description here

enter image description here

Please help as I am at such a loss here!!!

1
What data type is "no"? Looks like a string, so will need to be like "test123" - Nathan_Sav
Both "ItemNo" & "No" are text type. - Shadyjunior
It also appears you never set ItemNo in the code. Is this variable being set somewhere? - Doug Coats
@R.Langdell so you will need parenthesis as my example - Nathan_Sav

1 Answers

0
votes

change too:

 LintelID = DLookup("ID", "ImportProductAndTypes", "No ='" & ItemNo & "'")

It also appears you never set ItemNo in the code. Is this variable being set somewhere?