Question 1. Do not use the PO number as your primary key, create a table like:
Code:
tblPO
PO_ID PO_Number ---> other PO related fields
1 16-TEST-1
2 16-TEST-2
3 17-TEST-1
4 17-TEST-2
Assuming this is your format you can get the maximum sequential value by doing something like dmax("[PO_Number]", "tblPO", "[PO_Number] like '" & right(datepart("yyyy", date()),2) & "-TEST-*")
This assumes the text portion of the PO number is always the same if it's not, for instance the PO Number contains the customer ID, then you'd have to modify the lookup.
The other alternative is to do something like
Code:
tblPO
PO_ID PO_Date PO_Customer PO_Sequence
Then you could construct the PO number based on the three relevant fields (the year of the PO_Date, the customer number and the sequence) and all you'd have to do is increment the sequence number for that customer for that year using a similar dmax function.
Question 2. Don't use a control source of =Date()
Instead have vb code that populates the field whenever you go to create a new PO
Code:
if isnull(me.PO_Date) then
PO_Date = date()
endif
Question 3. You're looking at a cascading combo box there are tons of examples out there
Let's say your first combo box is called cboVendorType
Let's say your second combo box is called cboVendor
In the ON EXIT (or similar property) of cboVendorType you would have code like
And the query driving cboVendor would be something like
Code:
SELECT * FROM tblVendor WHERE [VendorType_ID] = [forms]![Your_Form_Name]![cboVendorType]
Question 4.
You don't need an email to do this, you can create an audit log where every time a change is made it appends the information to a table. The table that was changed, the field that was changed, what it was changed from, what it was changed to, who made the change and when. I've always found this easier to do with unbound forms rather than bound forms though so if you're new I doubt you're using unbound forms.
Another option would be to place the requested changes in a secondary table and, pending your approval apply the change to the 'main' table. This would require a different front end for you and your users (a split database with 2 different front ends probably)
Question 5.
Again assuming your vendor combo box is named cboVendor let's say your vendor table is this:
Code:
tblVendor
V_ID V_Name V_Number V_Type
1 Vendor A V-001-1 I
2 Vendor C X-002-5 E
3 Vendor Z B-002-2 I
The query driving your cboVendor would be
Code:
SELECT V_ID, V_Name, V_Number FROM tblVendor WHERE V_Type = 'I'
for internal vendors for instance
Then on your form, because you do not need to store the vendor number (you can look it up through queries) you can have an unbound field with a CONTROL SOURCE of
=cboVendor.column(2)
Whenever you select a new vendor it would be updated with the Vendor number.
Question 6.
MAKE SURE YOU ARE USING A NORMALIZED TABLE STRUCTURE
i.e.
Code:
tblPO
PO_ID PO_Number ---> other PO related fields
1 16-TEST-1
2 16-TEST-2
3 17-TEST-1
4 17-TEST-2
tblItem
IT_ID IT_Desc ----> other item related fields
1 Item XYZ
2 Item ABC
3 Item QRS
tblPODetail
POD_ID PO_ID Item_ID PO_Qty ----> other detail related fields
1 2 3 5
2 2 2 10
3 2 1 20
4 4 1 30
If you use a normalized structure summing the value of items on a PO is simple.
Question 7. If you are using a BOUND form (a bound form is a form connected to a table or query)
In your form header put in an UNBOUND TEXT BOX name the text box fldSearch
Make the query driving your form have a criteria in the PO_Number field of
like "*" & forms!YourFormName!fldSearch & "*"
this will find any po where any part of the PO_Number can be entered
OR
like forms!YourFormName!fldSearch & "*"
this will find any po where the START of the PO_Number matches what the user entered.
If you are using unbound forms it's a different process but I don't think you're doing that, I can tell you how if you are.