I’ve been working with DLookup on a form but wanted to see if I could expand on it further.
When this database idea first came about, we were only processing about 100 bags in our system. We are now processing about 5000 bags. The bags are shipped to us from an outside location with numbers already assigned to the bags. Meaning, there could be duplicate numbers in the bags down the road.
In my table, I have the bag number Indexed with No Duplicates. I would like to change this to allow duplicates. Is it possible to run the code below but have the results fill into a separate form that I could then select the appropriate record based on the results which would populate my original subform that the Dlookup is running After Update?
My attachments:
testform - shows what the original subform looks like.
testoutcome - sample of how i would like the data to populate a new form to then be selected and transfered to the testform. the user would only be allowed to select one record from the list. the data would be sorted by Date In, newest at the top. If no record exist, message saying "no records found".
When this database idea first came about, we were only processing about 100 bags in our system. We are now processing about 5000 bags. The bags are shipped to us from an outside location with numbers already assigned to the bags. Meaning, there could be duplicate numbers in the bags down the road.
In my table, I have the bag number Indexed with No Duplicates. I would like to change this to allow duplicates. Is it possible to run the code below but have the results fill into a separate form that I could then select the appropriate record based on the results which would populate my original subform that the Dlookup is running After Update?
My attachments:
testform - shows what the original subform looks like.
testoutcome - sample of how i would like the data to populate a new form to then be selected and transfered to the testform. the user would only be allowed to select one record from the list. the data would be sorted by Date In, newest at the top. If no record exist, message saying "no records found".
Code:
Option Compare Database
Option Explicit
Private Sub BagNum_AfterUpdate()
'Control Source = Nz(DLookup("Control Source", "my table", "[Control Source after update value] = _
''" & [Control Source after upate value] & "'"))
Me.DateIn = Nz(DLookup("DateIn", "tblPropertyDetails", "[BagNum] = '" & [BagNum] & "'"))
Me.PropertyTypeID = Nz(DLookup("PropertyTypeID", "tblPropertyDetails", "[BagNum] = '" & [BagNum] & "'"))
Me.Notes = Nz(DLookup("Notes", "tblPropertyDetails", "[BagNum] = '" & [BagNum] & "'"))
Me.PropertyStatus = Nz(DLookup("PropertyStatus", "tblPropertyDetails", "[BagNum] = '" & [BagNum] & "'"))
Me.DetentionID = Nz(DLookup("DetentionID", "tblPropertyDetails", "[BagNum] = '" & [BagNum] & "'"))
Me.PropertyID = Nz(DLookup("PropertyID", "tblPropertyDetails", "[BagNum] = '" & [BagNum] & "'"))
Me.Check265 = ""
DoCmd.GoToRecord , , acNewRec
End Sub