Results 1 to 15 of 15
  1. #1
    Calteq is offline Novice
    Windows 8 Access 2013 64bit
    Join Date
    Oct 2019
    Posts
    11

    Revising Records


    Hi

    Not sure if this is the area to post this !

    I initially added teams to a table 'Teams' from a form, no problem.
    I can delete teams from this table via the form.
    But I get an error when I try to add another record.
    See images.

    Not sure why this is happening as I added the teams in the first place with no errors

    Any help will be appreciated

    Thx
    Geoff
    Attached Thumbnails Attached Thumbnails Relationships.JPG   Error.JPG  

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    You don't need this relationship.
    delete it and just use league tbl as the list to fill in the team.league field.

  3. #3
    Calteq is offline Novice
    Windows 8 Access 2013 64bit
    Join Date
    Oct 2019
    Posts
    11
    Quote Originally Posted by ranman256 View Post
    You don't need this relationship.
    delete it and just use league tbl as the list to fill in the team.league field.
    Thx
    But the origonal DB I used as a skelton for this DB works ok, I can update the Team Table using the Team Form, so it must be something I've done in contructing this more elaborate DB.
    oh well back to the drawing board.

  4. #4
    Calteq is offline Novice
    Windows 8 Access 2013 64bit
    Join Date
    Oct 2019
    Posts
    11
    Quote Originally Posted by Calteq View Post
    Thx
    But the origonal DB I used as a skelton for this DB works ok, I can update the Team Table using the Team Form, so it must be something I've done in contructing this more elaborate DB.
    oh well back to the drawing board.

    Also I can enter data directly into the table but not thro the form!

  5. #5
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Also I can enter data directly into the table but not thro the form!
    What table, Team or League? You mention both in your posts. "the table" must be the league table because the message is telling you that you cannot enter a child record when there isn't a parent record - or more likely in your case, your form isn't defining that relationship. You don't use single forms for this type of relationship. You have a subform on a main form. Main form identifies parent, sub holds the child records, link is made in form design between a field on each form (when you have selected the subform control in form design view). Maybe research forms with subforms for tutorials.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    Calteq is offline Novice
    Windows 8 Access 2013 64bit
    Join Date
    Oct 2019
    Posts
    11
    Quote Originally Posted by Micron View Post
    What table, Team or League? You mention both in your posts. "the table" must be the league table because the message is telling you that you cannot enter a child record when there isn't a parent record - or more likely in your case, your form isn't defining that relationship. You don't use single forms for this type of relationship. You have a subform on a main form. Main form identifies parent, sub holds the child records, link is made in form design between a field on each form (when you have selected the subform control in form design view). Maybe research forms with subforms for tutorials.
    Sorry it’s the team table I’m having the trouble with, I can add new leagues ok but not teams they are both continuous forms

    no sub forms,

  7. #7
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,557
    Can yu upload a zipped copy of the Db??

  8. #8
    Calteq is offline Novice
    Windows 8 Access 2013 64bit
    Join Date
    Oct 2019
    Posts
    11
    Files attached
    Attached Files Attached Files

  9. #9
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    You can add league, but when you try to add a Team that does not yet have a parent (League record) you will get that error.

    Update: Seems we posted at same time. I have just looked at your database, BUT am wondering why you are using .mdb with Access 2013?
    I attempted to add Team tester before adding that Team to a League or identifying a League as parent.Here i the error received.
    Click image for larger version. 

Name:	TeamWithoutLeague.PNG 
Views:	14 
Size:	43.7 KB 
ID:	40248

    Good luck

  10. #10
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,557
    Hi

    I changed a couple of field names so check the Relationships

    I added an Open Args event on the Command Button to Open Teams

    You can now add Teams
    Attached Files Attached Files

  11. #11
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I would suggest you stop and fix the errors. There are a lot of undefined variable errors.

    You have code like this
    Code:
    Dim a, b, d, h, h1, h2, w As Integer
    Dim i, ii, iii As Integer
    Lines like this do not do what you think they do.

    Variables a, b, d, h, h1, h2 are defined as Variant and only w is defined as an Integer
    Likewise variables i, ii are defined as Variant and only iii is defined as an Integer.

    In VBA, you MUST EXPLICITLY define each variable.
    Code:
    Dim a As Integer, b As Integer, d As Integer, h As Integer, h1 As Integer, h2 As Integer, w As Integer
    Dim i As Integer, ii As Integer, iii As Integer

    EVERY code module should have these two lines at the top:
    Code:
    Option Compare Database
    Option Explicit
    In most code pages, the line "Option Explicit" is missing.


    In table "tblLeague", there are two fields named "Date" and "Time". "Date" and "Time" are reserved words and built in functions and shouldn't be used for object names.
    Plus they are not descriptive. "Date" and "Time" of what??



    My 2 cents.......

  12. #12
    Calteq is offline Novice
    Windows 8 Access 2013 64bit
    Join Date
    Oct 2019
    Posts
    11
    Thanks for all replys
    SSfanu and mike60smart
    Very helpful

  13. #13
    Calteq is offline Novice
    Windows 8 Access 2013 64bit
    Join Date
    Oct 2019
    Posts
    11
    The origonal db is mdb !

  14. #14
    Calteq is offline Novice
    Windows 8 Access 2013 64bit
    Join Date
    Oct 2019
    Posts
    11
    Thx
    Whatever League is highlighted when 'Teams andFixtures' button is clicked only the first league is pulled into the form> shown in the form

  15. #15
    Calteq is offline Novice
    Windows 8 Access 2013 64bit
    Join Date
    Oct 2019
    Posts
    11
    Have solved the conundrum
    added to the 'Team Form'

    'Private Sub Form_BeforeUpdate(Cancel As Integer)

    Me!leagueno = intLeagueno

    End Sub

    Seems to work fine now.

    Thx to all those who took the time to reply

    Regards
    Geoff

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

Similar Threads

  1. Replies: 1
    Last Post: 12-09-2016, 08:58 AM
  2. Replies: 1
    Last Post: 04-06-2016, 09:26 AM
  3. Replies: 4
    Last Post: 03-29-2014, 01:29 AM
  4. Replies: 1
    Last Post: 01-24-2013, 05:50 PM
  5. Need some help revising some code...
    By seashton in forum Programming
    Replies: 2
    Last Post: 12-04-2010, 12:17 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