Page 2 of 2 FirstFirst 12
Results 16 to 30 of 30
  1. #16
    Adam1970 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2023
    Posts
    30

    Hi
    I have attached my relationship tables
    Attached Thumbnails Attached Thumbnails Capture.jpg  

  2. #17
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    Looks better than I thought, but maybe not quite right. Looks like there might be some repeating fields, but no idea what a Dim is (which I wonder why that is in at least 3 tables). Interesting that one field name seems to have escaped not having space(s) in its name.

    Whether or not it's all properly related depends on knowing the process that the db supports, which we don't. In that case, what's a Despatch? It seems many things are interdependent - as in it seems you can't have an Invoice without a Despatch, without an order, which you can't have without a quote. Can't have a quote without a product id either. You'd have to work through the process on paper or test your schema based on the process.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #18
    Adam1970 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2023
    Posts
    30
    Hi
    Dim is a manually entered field by the user & will later be used as a calculation for weight, but i can sort that later.
    Despatch is despatch note that will accompany the items once shipped.
    quotation is the 1st form & report required. once an order is taken the quotation is converted into an Order, hopefully a button will perform this (99% of the time all items would be ordered) the order would need to be amendable ie change qty, delete item add item etc. once order is ready the despatch note will be created again by a button, this will be identical to the order form but without prices. once despatch is complete an invoice is raised. there should be no changes allowed once the order has got to the despatch form.

  4. #19
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    I had to look up despatch. Apparently it is the UK spelling of dispatch.
    this will be identical to the order form but without prices
    Such situations are often handled by having multiple forms/reports for basically the same information or purpose. Better to have one and show/hide/alter things on the fly. I'd consider using the same object and just hiding controls.
    I'm getting lost as to whether or not your original question has been answered.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #20
    Adam1970 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2023
    Posts
    30
    Hi
    No unfortunately it hasn't.
    I would like 1 table that has 3 fields order no, despatch no & invoice no.
    With corresponding yes no fields.
    On the form if no check box is selected it is a quotation.
    If any of the boxes are checked then it represents that field.
    However the question was how can I get a different sequential number based upon the selected criteria.
    For Eg quote no. = QU00001
    Order number maybe SA00040, its 40 as the 1st quote maybe not the 1st ordered.
    This would need to be shown on the forms & reports etc.
    If I can get the solution I could use switch to populate the ref no on the form

    Thanks
    Adam

  6. #21
    Adam1970 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2023
    Posts
    30
    Hi
    If I have an orderno field in a table & form.
    Can I use an iif & dmax statement together on the form In code builder? For example
    0rderno = IIF(0rder=true,DMAX("orderno","quote table")+1, null)
    I would need this to work as soon as the yes/no is checked, would that be on event? It would also not allow the check to be removed once checked.
    Thanks again for any help
    Adam

  7. #22
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    try the checkbox click event. If your form is continuous you can't disable the checkbox, you would need to modify your code to something like this (untested)

    if isnull(orderno) and order then 0rderno =DMAX("orderno","quote table")+1
    order=not isnull(orderno)
    you would also need need the to ensure the orderno control is disabled so users cannot edit it

  8. #23
    Adam1970 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2023
    Posts
    30
    Hi
    I have attached an image of my table, i have worked created a button on my quoteform to open the specific record in orderform which works, however i also want the button to generate the new sequential order no. my vba code is

    onclick

    DoCmd.OpenForm "OrderForm", , , "quoteID=" & QuoteID


    OrderNo = DMax("OrderNo", "QuoteTable")+1

    am i missing something between the 2 commands as this is not working. I also tdeleted the second line of code & added a button on the orderform with the dmax code, but that didnt work either.

    i am an old guy trying to learn VBA as i go, so please be gentle if this is an easy fix.


    Click image for larger version. 

Name:	table.PNG 
Views:	17 
Size:	17.2 KB 
ID:	50069

  9. #24
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    So in that case you'd want your order number to be "1" ? What does "doesn't work" mean?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  10. #25
    Adam1970 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2023
    Posts
    30
    it's not filling the orderno field.
    Yes I would like the orderno. To be 1.

  11. #26
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    After a quick review of all I don't see where any vba (that you mentioned you're using) or query sql, or anything that suggests that you're committing any record additions or edits to a table. I think that at this point you should really consider posting a compacted and zipped copy of your db with instructions on what to do/open to work with your form(s). That should speed things up. If you have to remove tables to get the zip size down (methinks 500kb is max file size that you can upload) just make sure whatever's left will allow for a solution.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  12. #27
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    Is your order no field a number or text? If the latter, you can’t add. First you need to extract the number part, add 1 then put it all back together again. Also, if there are no existing values in the order no field, Dmax returns null, so you need to use the nz function around the dmax function.

  13. #28
    Adam1970 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2023
    Posts
    30
    Quote Originally Posted by CJ_London View Post
    Is your order no field a number or text? If the latter, you can’t add. First you need to extract the number part, add 1 then put it all back together again. Also, if there are no existing values in the order no field, Dmax returns null, so you need to use the nz function around the dmax function.
    Thanks CJ_London Nz function worked perfectly. I only have one more requirement for this part of the project & i can then move on to making the forms look prettier.

    the OrderNo is now populating the field however i have enter the following to the afterupdate event for the date, but its not populating the date, is this also something i can use NZ for?

    Private Sub OrderNo_AfterUpdate()


    If OrderNo = Null Then
    OrderDate = Null
    Else
    OrderDate = Date
    End If

    End Sub

  14. #29
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    null doesn't equal anything - either it is null or it isn't

    change

    If OrderNo = Null Then

    to

    If isnull(OrderNo) Then

  15. #30
    Adam1970 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2023
    Posts
    30
    Quote Originally Posted by CJ_London View Post
    null doesn't equal anything - either it is null or it isn't

    change

    If OrderNo = Null Then

    to

    If isnull(OrderNo) Then
    Great thanks worked perfectly, many thanks for your help
    Adam

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 8
    Last Post: 07-17-2022, 08:48 AM
  2. Finding missing numbers in a Sequential field
    By jjpuebla in forum Access
    Replies: 6
    Last Post: 08-27-2020, 08:39 AM
  3. Add New Line Item Detail to Invoice Based on Status
    By breakingme10 in forum Programming
    Replies: 2
    Last Post: 06-23-2014, 04:04 PM
  4. Sequential Numbers
    By cactuspete13 in forum Queries
    Replies: 5
    Last Post: 03-27-2013, 12:14 PM
  5. Replies: 3
    Last Post: 10-18-2009, 08:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums