By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,397 Members | 1,420 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,397 IT Pros & Developers. It's quick & easy.

072610-002, ds s combination of Date & ID, the format of date is mmddyy.

100+
P: 180
072610-002, ds s combination of Date & ID, the format of date is mmddyy.
how cn i make the id back to 001 when the date become 072710, it should appear like this 072710-001
Jul 29 '10 #1

✓ answered by NeoPa

I'm guessing, as I still have no response from you, that the code in codify products may be of some assistance to you. Clearly, you would need to design it on a per-date basis rather than per-category, but the concept appears to be the sort of thing you're after if I guess aright.

Share this Question
Share on Google+
19 Replies


patjones
Expert 100+
P: 931
You need to be a little more clear about what you're trying to do here. To me, it looks like you're asking how to reset the second part of the column back to "001" whenever the date changes, but I can't be sure.

Is that what you want to do? If so, what have you done so far to make it happen?

Pat
Jul 30 '10 #2

100+
P: 180
thnx alot 4 ur rply. ur corect, i want to reset the ID to 001 when the date changed. Coz i have a MS-Access2007 program-Data Tracking System. I almost done it, this s only my problem left.
in my table design i have field name Doc No, From, Date Receive, To, Date Released, Sender, title, Subject & Addressee. I set the Doc No to autonumber.
and wid ur help after i applied the =Date() & "-" & Format([ID],"000") i got the format i want, but my another problem is my old records became current date which is Doc No: here are my Doc No's before 072610-001, 072710-002, 072910-003, then after i applied the code they became the current date 073010-001, 073010-002, 073010-003 instead of my records date. i want to make the doc no be save, so that when i add records tomorrow, it must be different date. my old record Doc no must not affected. Hope u understand now. pls. help me
Jul 30 '10 #3

patjones
Expert 100+
P: 931
I think =Date() & "-" & Format([ID],"000") is a good way to assign the value to that column.

I'm not sure why your old records would update to the current date, unless you are running an update query that somehow acts on all the records in the table.

Pat
Jul 30 '10 #4

NeoPa
Expert Mod 15k+
P: 31,768
You will need to do a DMax() call into your table. I'd help, but you haven't provided any information on what anything is called. If you can say what the names of the table and the index field are (without using any more abbreviations which are outlawed here) and explain where you are trying to do this coding, then I expect I can give you some example code to get you going with.

Welcome to Bytes!
Jul 31 '10 #5

100+
P: 180
@NeoPa
i created a table and that is my database, having a field name Doc No. Data type is Autonumber. then i created a form w/c i put a textbox, that textbox is my doc no. and to the datasource i put ur suggested code, and then it is correct that the output for example is 072610-001. but the other case is, i want my database to be updated. can i send to you my program? i admit it, i can't explain it well to you. pls. tell me where can i send mybe u cn give ur email address. pls. help me.. i believe you can help me because all your suggestions/opinion are correct.
Aug 2 '10 #6

100+
P: 180
yes its act on all records on the table. how can i do these, that when the date changed, the no. will reset to 001, and this date and no. will be saved to my table. pls. help me..
Aug 2 '10 #7

100+
P: 180
onething, how can i change this date for example 07/26/2010-001 to 072610-001
Aug 2 '10 #8

NeoPa
Expert Mod 15k+
P: 31,768
Eneyardi,

I am not about to give out my email address, nor do I choose to look at your database at this time. If I ever choose to do that I will let you know.

For now, we are interacting through a forum, which can be complicated, but needn't be too much so for this assuming you can provide consistent logical information.

What we have at this time is a field name [Doc No], but no table name. The field is explained as being of type AutoNumber, yet it is also described as containing non-numeric data (EG. "072610-002"). This is not possible, so it leaves us wondering what you're talking about.
Aug 2 '10 #9

100+
P: 180
@NeoPa
pls. help me. my table name is table1 and it has a field of doc no w/c data type is autonumber, sender data type is text & addressee data type is also txt. table1 is my database, and i have a form w/c datasource is table1. on that form i put a textbox that the datasource is doc no. the other txtbox is sender and addressee. as i said in my previous question. how can i update the doc no of my database? because the the doc no in the form is combination of date and no. (ex. 072610-001) and i want to make this doc no will reset to 001 when the date becomes 072710. so it should appear 072710-001, and it must save to my database. pls. help me..
Aug 3 '10 #10

100+
P: 180
@zepphead80
pls. help me..
Aug 3 '10 #11

NeoPa
Expert Mod 15k+
P: 31,768
It seems you want help, but are unable or unwilling to read what we are saying.

We cannot help you when your question makes so little sense. Please reread what has already been said and then continue by explaining your situation in a way that makes sense. I've explained clearly why it doesn't make sense at the moment. Unless a question makes sense it's impossible to answer it.
Aug 3 '10 #12

patjones
Expert 100+
P: 931
I guess what we are confused about (speaking for myself at least) is how the document number gets assigned, and what date you are using. You are saying that the document number is composed of a date, but what date? Today? Yesterday? Some date that the user enters? Are you asking how to assign the document number during the entry and save of a new record?

Pat
Aug 3 '10 #13

100+
P: 180
The Doc No. is combination of two fields; Date and Autonumber
the date is current date. so the Doc No. is look like this one for example. 072610-001 I've already done this thing, my another problem nw is how can i save this to my database w/c name is table1. because in a form it's look like it only show up but cannot save. I know this is simple but i don't know where to put the coding. pls. help me..
Aug 4 '10 #14

patjones
Expert 100+
P: 931
What code are you currently using to save records to the table? Do you have a button on the form or some other control that tells Access to save the information currently in the form?

Pat
Aug 4 '10 #15

100+
P: 180
i used the command button wizard for saving records.
Aug 5 '10 #16

100+
P: 180
y u haven't rply? pls.. help me, do you have sample program related to these thing? pls.. let me know..
Aug 5 '10 #17

NeoPa
Expert Mod 15k+
P: 31,768
eneyardi: y u haven't rply? pls.. help me
The answer is simple. We cannot help when you don't give answers to our questions or respond to our requests.

We cannot do this for you. We can only work with you to help you find a solution that fits your problem.

In the absence of any meaningful replies from you there is very little we can do. I appreciate English may be a difficult language for you. I can sympathise, but it doesn't change the fundamental facts of the matter, which are that we cannot help you without your meaningful responses.
Aug 5 '10 #18

100+
P: 180
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. If Me.NewRecord Then
  3. Me.project_sequencenum = DMax("project_sequencenum", "tblprojects") + 1
  4. End If
  5. Me.txtdatesequence = Me.project_date & "-" & Me.project_sequencenum
  6. Me.txtdatesequence = Format(Me.project_date, "yyyymmdd") & "-" & Me.project_sequencenum
Aug 9 '10 #19

NeoPa
Expert Mod 15k+
P: 31,768
I'm guessing, as I still have no response from you, that the code in codify products may be of some assistance to you. Clearly, you would need to design it on a per-date basis rather than per-category, but the concept appears to be the sort of thing you're after if I guess aright.
Aug 9 '10 #20

Post your reply

Sign in to post your reply or Sign up for a free account.