asteropi
Member
- Local time
- Tomorrow, 00:09
- Joined
- Jun 2, 2024
- Messages
- 136
I'm not sure where to post this, so I hope it works here. If not, feel free to move it around
So I am new to access and I need some help
I have a table with a customer code field and a customer type field.
The customer type is simply 2 options (Retail or Wholesale) and I made it a drop down list.
And I want the customer code to be generated as such: taking the first letter of the customer type and adding the date and a random number at the end. It has to be indexed and it has to be unique values.
The way I want it to work is to start at a blank form, choose the type of customer (found that), take that initial (found that too), and then feed the initial to the customer code, generate the code and feed that back to the table.
So far in my form I have a CustomerType comdo box which gets the values from the table (Retail/Wholesale), then an unbound CustomerT text box which gets the initial of the type with the IIF command (R/W) and after that it's a mess.
I can create an unbound text box to generate the code the way I want it (=CustomerT & Date &random number), but that code is not indexed nor does it feed back to table. Same goes for queries.
On the other hand,if I put the CustomerCode to be bound to the table and have a default value (let's say I inpud default W-Date-RndN, it does not change that value when I alter the customer type, because of course it's bound to the table and not the CustomerT source
I just can't wrap my head around how I should go about it.
Bear in mind that I have minimum knowledge regarding VBA and SQL, so literally ANY help is appreciated.
So I am new to access and I need some help
I have a table with a customer code field and a customer type field.
The customer type is simply 2 options (Retail or Wholesale) and I made it a drop down list.
And I want the customer code to be generated as such: taking the first letter of the customer type and adding the date and a random number at the end. It has to be indexed and it has to be unique values.
The way I want it to work is to start at a blank form, choose the type of customer (found that), take that initial (found that too), and then feed the initial to the customer code, generate the code and feed that back to the table.
So far in my form I have a CustomerType comdo box which gets the values from the table (Retail/Wholesale), then an unbound CustomerT text box which gets the initial of the type with the IIF command (R/W) and after that it's a mess.
I can create an unbound text box to generate the code the way I want it (=CustomerT & Date &random number), but that code is not indexed nor does it feed back to table. Same goes for queries.
On the other hand,if I put the CustomerCode to be bound to the table and have a default value (let's say I inpud default W-Date-RndN, it does not change that value when I alter the customer type, because of course it's bound to the table and not the CustomerT source
I just can't wrap my head around how I should go about it.
Bear in mind that I have minimum knowledge regarding VBA and SQL, so literally ANY help is appreciated.