ChrisLeicester
New member
- Local time
- Today, 18:08
- Joined
- Feb 14, 2025
- Messages
- 12
Hi
I decided to split the functions and design two forms and not use the one for both functions,
I have worked out the where function which works for both forms and have moved onto the next refinement where i want to check that the 'purchase order' requested does exist in the form/query and if not gives a message box to say not found.
Taking onboard what you suggest I am trying to refresh my limited knowledge of VBA and have written the following;
How does this look, before I entered it in the access I thought it better to check if I have made any glaring mistakes.
Thanks
Chris
I decided to split the functions and design two forms and not use the one for both functions,
I have worked out the where function which works for both forms and have moved onto the next refinement where i want to check that the 'purchase order' requested does exist in the form/query and if not gives a message box to say not found.
Taking onboard what you suggest I am trying to refresh my limited knowledge of VBA and have written the following;
Code:
Private Sub CheckPORecords
Dim POexp as string ‘Expression for Dcount command
Dim Formdomain as string ‘Domain for Dcount command
POexp = “[ProdOrderID]” ‘ Primary key field called [ProdOrderID]
Querydomain = “PurchaseOrderListQ” ‘Query [PurchaseOrderListQ] underlining form
If DCount ( POexp , Querydomain , )=0 then
MsgBox "Purchase Number Not Found", vbOKOnly, "Incorrect P.O. Number"
Me.”POSelected” = null
Else
DoCmd.OpenForm "ViewPurchaseOrderFM", , ,"ProdOrderID = '[Forms]![SelectPOnumberFM]"
DoCmd.Close acForm, "SelectPOnnumberFM", acSaveNo
End if
End sub
How does this look, before I entered it in the access I thought it better to check if I have made any glaring mistakes.
Thanks
Chris