Search form drop down showing different formats

jjake

Registered User.
Local time
Today, 03:37
Joined
Oct 8, 2015
Messages
291
I have a form [frmPOLookup] with a combo box [cboPOLookup] that looks up purchase orders by [OrderID]

I have 2 different purchase types. Maintenance and Project.

On my purchase order form i run the following code which generates a PO# based on what type of purchase it is.

Code:
Private Sub PurchaseType_Change()

If Me.PurchaseType.Value = 1 Then 'Maintenance

Me.PONumber = Format([OrderDate], "mmddyy") & Format([OrderID], "00\M")

ElseIf Me.PurchaseType.Value = 2 Then 'Project

Me.PONumber = Format([OrderDate], "mmddyy") & Format([OrderID], "00\P")

End If

End Sub


On my PO Lookup form is it possible to show in the drop down combo box the purchase order numbers with M's and P's

e.g Current

110416201
110416200
110416199

e.g Proposed

110416201P
110416200P
110416199M
 
It appears to me that you are already adding the M & P on to the end of the number, although something doesn't add up because it looks like you are actually adding something similar to this:- OO\M... So it's either a case that I've missed something or you have not quite explained everything.



Sent from my SM-G925F using Tapatalk
 
If the PurchaseType can be included in the combo box row source query then I think you could add an expression to the query to form the result you want. Something like:

Code:
Display PO:  IIF([PurchaseType] = 1, Format([OrderDate], "mmddyy") & Format([OrderID], "00\M"),Format([OrderDate], "mmddyy") & Format([OrderID], "00\P"))

assuming 1 and 2 are the only values that PurchaseType can have, i.e., the only alternative to M is P.
 
It appears to me that you are already adding the M & P on to the end of the number, although something doesn't add up because it looks like you are actually adding something similar to this:- OO\M... So it's either a case that I've missed something or you have not quite explained everything.



Sent from my SM-G925F using Tapatalk

You are correct, I am currently adding the M or P onto the end of the number, but only in my PO form and in my report. I have a lookup form that will only display the PO# without the M or the P in the drop down combo. I was asking if its possible to display the M and the P in the drop down list on my search form.

As far as the 00 part, that was part of a code that someone else gave me so I'm not quite sure how it works. But it does what I need!
 

Users who are viewing this thread

Back
Top Bottom