0
votes

I have a Form the fields are UPC, PurDate and Price. The Price is controlled by a Dlookup to get the most recent price from the Price Table. It works by the user scanning the barcode of the product that fills the UPC field and the Price is automatically filled. This works good so far.

The problem is that some products do not have barcodes so I want to be able to manually fill the price for that item. Is there anyway to 'override' the Dlookup function or use some vba code to fill the Price field with user input?

Or maybe setup a UPC code eg. 0001 and when that code is selected the user can enter a price?

1
Not if DLookup is in textbox ControlSource property. Use code (macro or VBA) to lookup price and populate field. Bind textbox to field. User can type over value retrieved. - June7
Thank you, that worked. I placed the Dlookup in vba and used an event to populate the textbox. - newbieDB Builder

1 Answers

0
votes

A control with an expression in ControlSource does not allow edit by user. Instead, use code (macro or VBA) to lookup price and populate field. Bind textbox to field. Now user can type over value retrieved. The real trick is figuring out what event to put code into.