Re: searial noumber (2k)

Dear Hans ;
I built a querr from table contain 3 feald ( id-name-chick) i fill the two fealds only ( id& name) . i nead when i run queri the query ask me give me the first no of the chick i put 1500 or any number it is automatic fill the feald chick with 1500-1501-1502 etc at the end of the data .
I hope u understand me . Thanks 4 U .
Ashraf

Re: searial noumber (2k)

I don't know how to do this in a query (it would probably involve writing a custom function).

In this case, I would loop through the records of the table in code.

Switch to the Visual Basic Editor (Alt+F11)
Select Insert/Module
Select Tools/References...
Find Microsoft DAO 3.6 Object Library in the list of references.
If it is not set (checked), do so now.
Close the References dialog.
Copy the following code into the module:

Re: searial noumber (2k)

Thank u Hans ,
That code is work good but also that not i want . i put a file explan to u what i do , when u run the Q1u will found that feld sn is empty . i want to make it as searil number with evry time i open the Q1.

Re: searial noumber (2k)

1. You have posted a database which is for a large part in a script which I (and most Loungers) can't read, and which is confusing to use for me because it's partly left-to-right and partly right-to-left
2. I don't understand why you would want to change all values in a field in a table each time you open a selection query.
3. I have an idea of how to display the serial numbers in a form, but I can't save a new form in your database - this may have to do with the language settings.

Re: searial noumber (2k)

Dear Hans :
I have a mdb for salary i print a report contain the number of chick i do it at a report only i want to save these numbers in the tabel so i want to pur it evry month . it is from right-to-left couse i do it by arabic lanauge .
Ashraf

Re: searial noumber (2k)

Part of the confusion we are experiencing with your sample is that the pieces don't fit together. You have a query named Q1, that returns fields from tblTest. That table has arabic field names except for the field sn. The form you included shows english field names, which don't match any field names in the table, so it always shows a #Name? error in all its controls. If you want to put check numbers in the table, you don't want to overwrite any check numbers that are already there, and the query doesn't really have anything to do with it unless you want to display numbers but not actually put them into the table. I see no point in doing that, so I suspect that is not what you want to do.

Another problem is that putting the check numbers in all at once like that won't necessarily attach the right check number to the person that check is issued to. Are you going to add the check numbers and then find the check and write it for the calculated amount? If not, then you will need to enter the check numbers one at a time because records in Access don't really have any preset order. They have the order in which they are entered (the natural order), but as soon as you put a primary key on the table, that affects the sort order, and you can't rely on the natural order any longer.

Re: searial noumber (2k)

Thank all for help . I chanegd all feald to english . when u run Q1 it ask u about the month put 4 examble (feb) and the year 2001 . u will found that sn will empty . so i want after i put the month& year the Q1 ask me the chik start with no : i put 1300 then the Q1 will full the sn feald with 1300-1301-1302 etc ..
if the Q1has 7 records only the chick will be 7 also . after taht i do a report depond on the Q1 to print the chicks as a searial .
Ashraf

Re: searial noumber (2k)

Dear Ashraf,

I have attached a version of your database with a report based on Q1. When you open the report, you will be prompted for month, year and start number. Serial numbers are assigned dynamically - they are not stored in the table. As Charlotte has remarked, there is no guarantee that these numbers will correspond to the correct employee.

Re: searial noumber (2k)

Ashraf,

I don't know of a way to do this in a parameter query in Access. Jefferson Scher came up with the sggestion to export the data to Excel, type 1500 (or whatever start number you want), then fill down as far as needed, and finally reimport the data into Access.