Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    2 Star Lounger
    Join Date
    Nov 2002
    Posts
    160
    Thanks
    0
    Thanked 0 Times in 0 Posts

    searial noumber (2k)

    How i can do searial number at query . i want the query ask me give me the first number 4 ex i will put 1500 then the query start from 1500 & stop at the end of the records.
    Ashraf

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: searial noumber (2k)

    In the criteria row of the query design grid, under the serial number, enter the following condition:

    >=[Start With]

    Some browsers do not display "greater than or equal" correctly; I have attached a little screen shot.
    Attached Images Attached Images
    • File Type: png x.png (1.6 KB, 0 views)

  3. #3
    2 Star Lounger
    Join Date
    Nov 2002
    Posts
    160
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: searial noumber (2k)

    sorry hans not work . i want to make a serial no manual .
    Ashraf

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: searial noumber (2k)

    Do you mean that you want to create an update query that fills the serial number field?

  5. #5
    2 Star Lounger
    Join Date
    Nov 2002
    Posts
    160
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    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:

    <img src=/w3timages/blueline.gif width=33% height=2>

    Sub FillTable()
    Dim dbs As DAO.Database
    Dim rst As DAO.Recordset
    Dim lngIndex As Long
    Dim strInput As String

    On Error GoTo Err_Sub

    strInput = InputBox("Start With", "Serial Number")
    If strInput = "" Then Exit Sub

    Set dbs = CurrentDb
    Set rst = dbs.OpenRecordset("tblTest") ' Substitute actual table name
    With rst
    Do Until .EOF
    .Edit
    !chick = lngIndex
    .Update
    .MoveNext
    lngIndex = lngIndex + 1
    Loop
    End With

    Exit_Sub:
    If Not rst Is Nothing Then
    rst.Close
    Set rst = Nothing
    End If
    Set dbs = Nothing
    Exit Sub

    Err_Sub:
    MsgBox Err.Description, vbExclamation
    Resume Exit_Sub
    End Sub

    <img src=/w3timages/blueline.gif width=33% height=2>

    Remember to replace tblTest by the name of your table.
    With the blinking cursor somewhere in this procedure, click the Run button or hit the F5 key.

  7. #7
    2 Star Lounger
    Join Date
    Nov 2002
    Posts
    160
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.
    Attached Files Attached Files

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    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.

  9. #9
    2 Star Lounger
    Join Date
    Nov 2002
    Posts
    160
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  10. #10
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    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.
    Charlotte

  11. #11
    2 Star Lounger
    Join Date
    Nov 2002
    Posts
    160
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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
    Attached Files Attached Files

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    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.
    Attached Files Attached Files

  13. #13
    2 Star Lounger
    Join Date
    Nov 2002
    Posts
    160
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: searial noumber (2k)

    Thank U Hans very much , but also i back to the first how i put that searil at table .
    Ashraf

  14. #14
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    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.

  15. #15
    New Lounger
    Join Date
    Jan 2003
    Location
    Manchester, Gtr Manchester, England
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: searial noumber (2k)

    Could you have a hidden autonumber field that gets filled then run another query that uses an expression to fill the field with (hidden autonumber +1500)?
    Mike

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •