Page 2 of 2 FirstFirst 12
Results 16 to 30 of 30
  1. #16
    cbende2's Avatar
    cbende2 is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jun 2014
    Location
    Louisiana
    Posts
    370

    Ok, well please post back if you figure it out, I'd like to know how you go about solving it.

  2. #17
    cbende2's Avatar
    cbende2 is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jun 2014
    Location
    Louisiana
    Posts
    370
    Maybe look into reverting back to your original, and whenever you go to create a new incident, have it append that incident to EVENT INFO table also. I'll do a little looking into this.

  3. #18
    cbende2's Avatar
    cbende2 is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jun 2014
    Location
    Louisiana
    Posts
    370
    Ooh bro, I just caught a big problem in your database. You're relationships are not established correctly. You have the PK(autonumber) in [FATAL INCIDENTS] going to Incidents(date field) in [EVENT INFORMATION].

    You may want to do a little research on relationships and Foreign Keys.

    Basically, a PK(autonumber) will be linked to a FK(number).

  4. #19
    MatthewR is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    118
    Uh oh. You're talking about the Incident field in [EVENT INFORMATION], right?

    But it's technically a number field, right? That's what it says in Design view. It's a lookup that has a hidden foreign key, a date, and an address, and only displays the date.

    Is that a problem, that I have it displaying the date?

  5. #20
    cbende2's Avatar
    cbende2 is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jun 2014
    Location
    Louisiana
    Posts
    370
    Ooh, It's a lookup field....

    Sorry I didn't realize that.

    Not many people here use lookup fields. I actually have never used them before, therefor I have no experience with them.

    Check out this link: http://access.mvps.org/access/lookupfields.htm

    It just kind of talks about the different problems that will arise with lookup fields.

  6. #21
    MatthewR is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    118
    Well, I'm relieved that my relationships are okay.

    But darn, that's too bad that there's all those problems with lookups. I've been teaching Access to myself, and I watched a couple tutorials that said that Lookups were useful. I didn't realize there were downsides.

  7. #22
    cbende2's Avatar
    cbende2 is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jun 2014
    Location
    Louisiana
    Posts
    370
    Same here

    I think most access users are self taught, using forums and videos.

    Hmmm, back to the original problem.

    If we revert the change that we made you said it works.

    Now... one option you could do is run an append query to add the new record created in FATAL to EVENT when you click the "save" button. That way, all new records will automatically be created in the EVENT Table.

  8. #23
    MatthewR is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    118
    Ah, that's good to know that I'm not the only one.

    Yeah, that's an interesting idea, with appending the query when saving a new incident. I think I tried looking up how to do that once, and couldn't figure it out. Do you know how I would write that? Here's my current code for the save button on the ADD INCIDENT form:

    Private Sub AddIncident_Click()
    Call DoCmd.RunCommand(acCmdSaveRecord)
    DoCmd.Close ObjectType:=acForm, ObjectName:=Me.Name
    End Sub

  9. #24
    cbende2's Avatar
    cbende2 is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jun 2014
    Location
    Louisiana
    Posts
    370
    Hmm, we need to think of criteria for the append query.

    Let me ask you... whenever you add a new FATAL record, will it have today's date. If so, you could run an append query WHERE Incident Date = Date()

  10. #25
    MatthewR is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    118
    Unfortunately no, it won't have today's date. When adding a new incident, the user only enters the date of the incident (which is always in the past), as well as the address.

  11. #26
    cbende2's Avatar
    cbende2 is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jun 2014
    Location
    Louisiana
    Posts
    370
    Or we can create a field specifically for this process.

    In FATAL INCIDENTS you can add a field called something like... [NewRecord], make it a (Yes/No) Data Type.

    Create an Append query Query1 to append all records from FATAL INCIDENTS where NewRecord Is checked Yes.

    Create an Update query Query2 that updates all FATAL INCIDENTS where NewRecord is Yes to update to No.

    When adding a new record, have the defaultvalue of [NewRecord] set to Yes. This Field does not have to be displayed anywhere. It is simply being used for this process.

    After hitting the save button, run Query1, then run Query2

  12. #27
    MatthewR is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    118
    Okay, thanks so much! I need to bolt from the office in a few minutes, but I'll give this a shot tomorrow or Thursday, and I'll let you know how it goes.

  13. #28
    cbende2's Avatar
    cbende2 is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jun 2014
    Location
    Louisiana
    Posts
    370
    Ok sounds good!

  14. #29
    MatthewR is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    118
    So, I really liked your suggestion... but I was in a really stubborn mood today. It was driving me crazy that my command button wasn't opening and filtering the EDIT INCIDENT form like I wanted it to, especially because I've had similar problems before. So, I wanted to try to get to the bottom of it, in case it happens again in the future.

    I did a lot of tinkering, and eventually I got it to work. I think there were 2 problems with what I was doing. First, my VBA for the command button was referring to the name of the control on the EDIT INCIDENT form, rather than the name of the control source. Second, my combo box held multiple values, whereas the corresponding field on the EDIT INCIDENT form only held one value, so that might have screwed things up. At least, I think that's what the problems were. I don't really know. All I know is that it works, and I'm a happy guy now.

    The VBA that is working for me now is:
    DoCmd.OpenForm "EDIT INCIDENT", , , "[Fatal Incident #]=" & Me.Text86

    (Text 86 is the field on the ADD/EDIT data page that displays the Fatal Incident #)

    I also found that it works as a Openform Macro as well, with this Where Condition:
    [Fatal Incident #]=[Forms]![HOME PAGE]![NavigationSubform]![Text86]

    So, my apologies for being stubborn and not following your suggestion. I'm sure it would have worked just fine, but I wanted to figure this out for my peace of mind.

    Again, thanks so much for all our help on this.

  15. #30
    cbende2's Avatar
    cbende2 is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jun 2014
    Location
    Louisiana
    Posts
    370
    You're welcome, I'm glad you were able to solve the original problem!

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

Similar Threads

  1. Replies: 7
    Last Post: 02-10-2014, 08:23 PM
  2. New Employee not appearing in form
    By Canadiangal in forum Forms
    Replies: 1
    Last Post: 06-09-2013, 05:15 PM
  3. Text appearing every time form is opened.
    By lmjje in forum Programming
    Replies: 2
    Last Post: 01-04-2013, 09:25 AM
  4. Replies: 6
    Last Post: 06-17-2011, 08:40 AM
  5. Replies: 5
    Last Post: 08-13-2010, 07:26 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