מספר רץ

benjih

New member
מספר רץ

שלום, יש לי שדה הנקרא MASSOFNUM אני רוצה שכאשר אני פותח רשומה חדשה לערך בשדה יווסף אחד. כרגע הערך הוא 5470433 כאשר אני פותח רשומה חדשה המספר החדש ברשומה החדשה יהיה 5470434 וכך הלאה והלאה. תודה
 

eli_leiba

New member
תהפוך את השדה ל identity

זה ב sql server יש מקום לסמון ב דיזיין ב enterprize manager אם אתה באקסס הפוך השדה למספור אוטמטי
 

benjih

New member
כן אבל,

כיצד אני מגדיר שהמספר האוטומטי יתחיל בנתון מסויים ולא ב1.
 

yaron881

New member
אם זו טבלה חדשה וריקה אז

עושים כך: בטבלה החדשה יוצרים שדה מספר אוטומטי , שומרים, ולא מכניסים כלום. יוצרים טבלה חדשה עם שדה אחד ,מספר שלם ארוך, בעל אותו שם כמו השדה בטבלה1 שומרים את הטבלה, נכנסים אליה ומכניסים לשדה את הערך שממנו רוצים שהמספר האוטמטי יתחיל פחות אחד (אם רוצים שהשדה האוטומטי בטבלה1 יתחיל מ-10000 נכניס לשדה בטבלה2 את הערך 9999) יוצרים שאילת הוספה. מטבלה2 לטבלה1 ומריצים. נקבל הודעה שמתווספת שורה אחת. נאשר, ונצא מהשאילתה. מה שקרה שבטבלה1 השדה האוטומטי יקבל ערך 9999. ניכנס לטבלה1 ונמחוק את הרשומה שיש שם. בפעם הבאה שניכנס לטבלה1 להכניס נתונים , השדה האוטומטי יקבל את המספר 10000. אם רוצים לעשות זאת לטבלה קיימת עם נתונים זה כבר נוהל אחר ואפשר לראות אותו בעזרה של ACCESS : For a table that contains records, you can also use this procedure to change the next value assigned in an AutoNumber field to a new number. Create a temporary table with just one field, a Number field; set its FieldSize property to Long Integer and give it the same name as the AutoNumber field in the table whose value you want to change. How? In Datasheet view, enter a value in the Number field of the temporary table that is 1 less than the starting value you want for the AutoNumber field. For example, if you want the AutoNumber field to start at 100, enter 99 in the Number field. Create and run an append query to append the temporary table to the table whose AutoNumber value you want to change. How? Note If your original table has a primary key, you must temporarily remove the primary key before running the append query. Also, if your original table contains fields that have the Required property set to Yes, the Indexed property set to Yes (No Duplicates), or field and/or record ValidationRule property settings that prevent Null entries in fields, you must temporarily disable these settings. Delete the temporary table. Delete the record added by the append query. If you had to disable property settings in step 3, return them to their original settings. When you enter a record in the remaining table, Microsoft Access uses an AutoNumber field value 1 greater than the value you entered in the temporary table.
 
למעלה