Results 1 to 15 of 15
  1. #1
    programmingbeginner is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2014
    Posts
    6

    Need help with array

    My company has a table full of orders. The customer is an unique order number but each item has a unique sku number. I want to use an array assign order 1 to each line item with that order number and push into a table. I am new to programming and have no idea where start.
    Array. Customer order. Sku
    1. 12 3 40. And
    1. 12340. And-1
    1. 12340. And-2
    2. 23300. 123
    2. 23300. 1244

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I don't understand. Why should each line have 1 assigned?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    programmingbeginner is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2014
    Posts
    6
    For 1 order to be shipped for that customer and than for a different customer I would have a 2.

  4. #4
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    I don't see why you need the 1 and 2 either - the order number already tells you which customer it is, since (I hope) the customer ID is kept in the Orders table.

    Can you provide a bit more information on what you are trying to do?

  5. #5
    programmingbeginner is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2014
    Posts
    6
    We are going to a different system and it will have to be uploaded differently. There will be one customer number and the sku numbers in different columns. I am trying to turn out current data into that format. Is there a way I can upload on here what I have and what I need

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Can attach files to post. Click 'Go Advanced' below the post editor window. Size limit of 500KB for uncompressed files, 2MB for zip.

    You want to assign a new identifier for each customer? This will not be easy in query or form. Review http://allenbrowne.com/ranking.html

    Otherwise, might need VBA procedure using recordset object to cycle through records and update field with new value.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    Have you done an analysis of your data to determine what tables you will need, and what fields they will have? You need to have some idea of your database structure before you can import.

    John

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    programmingbeginner,

    You're going to have to explain/describe your situation; what data you have; and what new data structure you need.
    We can't guess at your requirements. Please try to tell readers in plain English.

    Good luck.

  9. #9
    programmingbeginner is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2014
    Posts
    6

    Examples of table and what I want to do

    I am currently exporting the data from the table in access and doing the rest in excel. I want access to be able to do it all. I hope the visual helps because I am having trouble explaining since I do not know really what to ask for. I was just informed that it is called an array. Thank you so much for all your help





    Click image for larger version. 

Name:	Capture.PNG 
Views:	22 
Size:	13.3 KB 
ID:	17941

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Technically, every table is an array (most are 2-dimensions). An array is also a VBA programming object. I doubt it will be useful for your situation.

    What you show as desired output is a non-normalized data structure (3-dimension array). If a field is first populated with the Order sequence, a CROSSTAB query could produce that result.

    Here is one possible way to populate the Order field:

    UPDATE Tablename SET [Order] = DCount("*","Tablename","[Customer Code]='" & [Customer Code] & "' AND [SKU Code]<'" & [SKU Code] & "'")+1;

    What do you mean by 'going to a different system' - are you abandoning the Access database? I would find it alarming if you want to migrate to a setup that requires non-normalized data structure. This structure will give you lots of frustration down the road. What is this other system?

    How many possible SKU values could each customer have? A table/query is limited to 255 fields.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    programmingbeginner,

    Maybe June understands your setup and needs, but I don't. You're going to have to try harder to tell us in plain English WHAT you are trying to do.

    If you can't describe it, I don't think you can design/build it.

    Let me give you a scenario:

    I'm in front of you in a McDonalds line. I ask you "What you're working on"? What would you tell me, in plain English? And I'm not going to quit if you say, "Bugger off".

  12. #12
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Programmingbeginner -

    Everything you need can probably be done in Access; in fact the Customer - Orders - Products scenario is one of the commonest used to teach Access and databases in general.

    What is the table/field structure you are currently using? For this scenario, you need at least four tables (Customer, Product, Order and Order_Detail).

    In your screen diagram, I don't see any data for an order number - you won't get far without an order number and order table.

    What do you need the "Order" values (in red) for? I see no useful purpose for it, and what determines which line is "1" and which is "2"?

    If you are thinking about making a table that looks like your bottom line - don't. As June7 pointed out, you can get that result using a query.

    So, please show us your current structure (tables/fields) and we can go from there.

    John

  13. #13
    programmingbeginner is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2014
    Posts
    6

    Conversion Failure

    Click image for larger version. 

Name:	qryPic.PNG 
Views:	12 
Size:	8.3 KB 
ID:	17952Click image for larger version. 

Name:	Table Data Types.PNG 
Views:	12 
Size:	4.4 KB 
ID:	17953Click image for larger version. 

Name:	Update Qry Conversion Failure.PNG 
Views:	12 
Size:	29.6 KB 
ID:	17954I am getting a conversion Failure. How do I fix it?

  14. #14
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Change the Ranking field to a number type.

    I thought Customer_Code and SKU_Code would be text (SKU_Code shows a hyphen). If the fields are not text, then remove the apostrophe delimiters from the DCount arguments.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  15. #15
    programmingbeginner is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2014
    Posts
    6
    Thank you June7. It is doing exactly what I wanted. You have been a life saver!!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. export to a 2D array
    By pradeep.sands in forum Forms
    Replies: 4
    Last Post: 07-24-2013, 08:59 AM
  2. Would be an ARRAY statement in SAS.
    By arbnmedic in forum Access
    Replies: 2
    Last Post: 01-07-2012, 03:34 PM
  3. Array problem
    By dbdvl in forum Programming
    Replies: 6
    Last Post: 12-03-2011, 07:34 AM
  4. Array will not ReDim...
    By yeah in forum Programming
    Replies: 1
    Last Post: 10-08-2011, 06:30 PM
  5. How to use array? [ solved] Thanks.
    By wasim_sono in forum Programming
    Replies: 0
    Last Post: 10-20-2006, 12:00 AM

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