I have receiving a syntax error in this DLookUp clause. I am not very familiar with dlookup so any help is appreciated.
Code:If IsNull(DLookup("PartNumber_PK", "tbl_PartsInfo", "PartNumber_PK = '" & Forms!frm_Entry!txtPart.value"'")) Then
I have receiving a syntax error in this DLookUp clause. I am not very familiar with dlookup so any help is appreciated.
Code:If IsNull(DLookup("PartNumber_PK", "tbl_PartsInfo", "PartNumber_PK = '" & Forms!frm_Entry!txtPart.value"'")) Then
My issues was I first thought it was numerical, since part number is just a sequence of numbers but I guess access takes that as a string? Also had an extra " in there.
Solved now, thanks Paul.
No problem. I think Access is looking at the data type of the field, not analyzing the contents of it.
Makes sense then.
I am still having a problem with this statement...
It does not seem to recognize if it is null, or something else is happening. I have this bit of code in so that if the user is entering a part number, and this part number is not already in the Parts table (part number is PK) then it will add it, if it is already in the Parts table then it will only add it as the FK in the main table. My current code does not work. PI is my tbl_PartsInfo.
Code:If IsNull(DLookup("PartNumber_PK", "tbl_PartsInfo", "PartNumber_PK = '& Forms!frm_Entry!txtPart'")) Then PI![Description] = Me.txtDscrp.Value PI![PartNumber_PK] = Me.txtPart.Value Else: 'stuff
Solved. Had to include the PI.AddNew as a part of the IF statement.
Sorry, been in a meeting all morning. Glad you got it sorted.