Page 3 of 4 FirstFirst 1234 LastLast
Results 31 to 45 of 51
  1. #31
    harrytgs is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    38
    Sorry rpeare, do you mind doing this on Access for me??



    Would really appreciate :P

  2. #32
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Harry you need to learn how to replace the code, otherwise you won't know how to fix anything.

    Just go to the ON EXIT property of the BRANCHID field, you will see a bunch of code there, if you compare it to the new code I wrote on this my last post you will see it's slightly different (modifies a different field) if you replace the existing code with the code I've written it should work fine.

    The same thing goes for the TAG property of the bransomref field, just open the properties window and go to the TAG property it should say DE (click on any of the other fields on the screen and go to the TAG property and you'll see what I mean.

  3. #33
    harrytgs is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    38
    I am now getting a Run-time error '3464' - Data type mismatch in criteria expression.

    I am assuming this is because the lookup is on shop names, however the validation / record source is the branch ID.

    Also, why is the code talking about the bransom ID? The bransom ID is from the shops, the dispatch note is the WSHOP number ??

  4. #34
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Check to make sure all of the ID fields are listed as either autonumber on their own table, or number on any foreign table.

  5. #35
    harrytgs is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    38
    There are only two tables, and only ID is on branches - ID is autonumber and the ID on the bookings table is Text, and I can't change this because of the relationship.

  6. #36
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    remove the relationship, change the data type to number, then re-establish the relationship (note, it's not necessary to establish relationships in your databases, it can just smooth things out when it comes time to build queries etc)

  7. #37
    harrytgs is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    38
    Now run-time error '13', Type Mismatch. Again, assuming this is because the lookup is on shop names, however the validation / record source is the branch ID.

  8. #38
    harrytgs is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    38
    Also, when trying to update, I click on a record at the top and I get a run-time error '3021', No Current Record.

  9. #39
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    The lookup is looking at column 1, the second column (column counting starts at 0) so that should not be the problem. Not sure what you mean by the second thing

  10. #40
    harrytgs is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    38
    I have had a look at the properties, it seems that the source is the BranchID (1,2,etc) but the dropdown (lookup) is for the Branch name (London,Holloway,etc) hence the problem...

    Not entirely sure how to change it without problems...

  11. #41
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    The source of that dropdown box should be a query based on the locations table with the ID being the first field, the location text being the second field and the bound column being the first field with the width of that column set to 0 so all you see when you're doing data entry is the location description.

  12. #42
    harrytgs is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    38
    Would you mind checking the database to confirm please?

  13. #43
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Post an updated database in access 2003 or below format. I can't read 2007 files most of the week.

  14. #44
    harrytgs is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    38

    Access 2003 format

    I have attached.

    Thanks

  15. #45
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    1. You changed the primary key field of your TBL bookings but your list box no longer reflects that. Go to PROPERTIES window of the list box Lst_BOOKINGS. Change the SQL (ROW SOURCE) statement running this list box to:

    Code:
    SELECT Bookings.[Bransom Ref], Bookings.Ref, Bookings.BranchID, Bookings.[Date Received], Bookings.Description, Bookings.[Date Dispatched], Bookings.[Dispatched By] FROM Bookings ORDER BY Bookings.[Date Received] DESC;
    Change the column count to 7.
    Change the column widths to 0";1";1";1";1";1";0.5"

    NOTE: If you want the bransom ref field to show in the list box make the first field have a width larger than 0

    2. You didn't change the data source for the location combo box so that it stored the locationID. The ROW SOURCE property should be this query:

    Code:
    SELECT Branches.BranchID, Branches.Branch
    FROM Branches
    ORDER BY Branches.Branch;
    3. You didn't change any of the code I told you to in the ON EXIT property of the location combo box.

    Replace the existing code in that event with the code listed 10 or 15 posts ago

    Code:
    Dim sMaxRef
     
    sMaxRef = DMax("[Bransom Ref]", "Bookings", "([BranchID]) = " & Me.BranchID)
     
    If Not IsNull(BranchID) Then
        If IsNull(sMaxRef) Then
            Bransomref = UCase(Left(BranchID.Column(1), 2)) & "-0000001"
        Else
            Bransomref = UCase(Left(BranchID.Column(1), 2)) & "-" & Right("000000" & CLng(Right(sMaxRef, Len(sMaxRef) - 3)) + 1, 6)
        End If
    End If
    4. You didn't change the TAG property of the BRANSOMREF field to DE, if you don't do this that field will not be cleared out when new records are added.

    CHANGE THE TAG PROPERTY OF BRANSOM REF TO THE TEXT STRING:

    DE

    5. Change the ON CLICK event of your list box (LST_BOOKINGS) to the following

    Code:
    Dim db As Database
    Dim rst As Recordset
    Dim ssql As String
    
    Set db = CurrentDb
    ssql = "SELECT * FROM Bookings WHERE (([Bookings]![BRANSOM REF]) = '" & Lst_Bookings & "')"
    Set rst = db.OpenRecordset(ssql)
    rst.MoveFirst
    
    Me.Ref = rst.Fields("ref")
    Me.BranchID = rst.Fields("branchid")
    Me.DateReceived = rst.Fields("date received")
    Me.Description = rst.Fields("description")
    Me.DateDispatched = rst.Fields("date dispatched")
    Me.DispatchedBy = rst.Fields("dispatched by")
    Me.Bransomref = rst.Fields("bransom ref")
    
    rst.Close
    Set db = Nothing
    DoCmd.GoToControl ("BranchID")

Page 3 of 4 FirstFirst 1234 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Making changes to front end.
    By OrangePie in forum Access
    Replies: 4
    Last Post: 07-27-2011, 11:19 AM
  2. making a query
    By macattack03 in forum Access
    Replies: 2
    Last Post: 04-23-2011, 12:00 PM
  3. Importing cell notes from excel
    By timmy in forum Import/Export Data
    Replies: 1
    Last Post: 03-12-2011, 01:34 PM
  4. Need date when there is notes
    By Brian62 in forum Queries
    Replies: 0
    Last Post: 09-03-2009, 04:19 PM
  5. Import Lotus Notes address book into a MS Access table.
    By acheo in forum Import/Export Data
    Replies: 0
    Last Post: 02-19-2007, 02:43 PM

Tags for this Thread

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