Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 36
  1. #16
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    That query had the "C" bit in the criteria that I thought looked goofy. This appears to work:



    SELECT "C" & [Cap_ID] AS PartName, [Capacitors].[Cap_Value] & "Uf " & [Cap_Type] AS PartQ
    FROM Capacitors
    WHERE ((( [Cap_ID])=[Forms]![Capacitors]![Cap_ID]));
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  2. #17
    MadTom's Avatar
    MadTom is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Location
    CT and VT
    Posts
    206
    Worked around my problems, added a checkbox and Qty fields in my table. I have an append query (add parts to projects) and update query (to remove checks and updates Quantity of parts on hand. One thing I'm stuck on, I have a button to add to Project table, runs the queries ( DoCmd.SetWarnings False, DoCmd.OpenQuery "QueryAppendProject", and DoCmd.OpenQuery "QueryUpdateCapacitors") queries check if checkbox is true. If I don't check the box and add a Qty I want to goto that record when query ends. I added this, If Me.[Cap_Project] = False Then, MsgBox "You must fill in the Project Qty", vbOKOnly, "Data entry is not complete" but I would like it to return to that record in my form. Thanks!

  3. #18
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    It's harder to read code in that format, but generally

    Me.DesiredControl.SetFocus
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #19
    MadTom's Avatar
    MadTom is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Location
    CT and VT
    Posts
    206
    What do I add for DesiredControl? All a learning experience!

  5. #20
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    The name of the control (textbox, combo, etc) you want the focus put on.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #21
    MadTom's Avatar
    MadTom is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Location
    CT and VT
    Posts
    206
    Sorry Paul, I don't follow your code?

  7. #22
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    If they didn't fill out quantity and you want them to, after your message box you'd have:

    Me.Quantity.SetFocus

    replacing "Quantity" with the name of the textbox.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #23
    MadTom's Avatar
    MadTom is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Location
    CT and VT
    Posts
    206
    OK, that seem to do what I need! I'm looking into he SetFocus code, thanks!

  9. #24
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #25
    MadTom's Avatar
    MadTom is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Location
    CT and VT
    Posts
    206
    I have this code that works if current record in Cap_ProjecctQty is blanks, but I want it to work if all records in that field are Null. Thanks for all the help!

    If IsNull(Form!Cap_ProjectQty) Then
    Me.cmdAddtoProject.Enabled = False
    Else
    Me.cmdAddtoProject.Enabled = True
    End If

  11. #26
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    You mean all fields? You can test each:

    If IsNull(Form!Cap_ProjectQty) OR IsNull(Form!SomeOther) Then

    or use the Tag property and loop all controls, checking the ones with the appropriate value in the Tag property.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #27
    MadTom's Avatar
    MadTom is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Location
    CT and VT
    Posts
    206
    Maybe I didn't state it correct. I want to check if there are no numbers entered in a field's column. or the total in the column is Null. still looking
    Field name is Cap_ProjectQty . Just want to check all records in one field (Cap_ProjectQty) (type number), If Null would like to
    Me.cmdAddtoProject.Enabled = False,
    Else, Me.cmdAddtoProject.Enabled = True
    Thanks!
    Last edited by MadTom; 11-19-2018 at 09:38 AM.

  13. #28
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Okay. All records in the table, or records displayed on a subform, or?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  14. #29
    MadTom's Avatar
    MadTom is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Location
    CT and VT
    Posts
    206
    All records in one field Cap_ProjectQty table, when in a form.

  15. #30
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    I'm not clear on which way you want the logic, so try this with/without the Not:

    If DCount("*", "TableName", "Cap_ProjectQty Is Not Null") > 0 Then

    tests if any record has a value

    If DCount("*", "TableName", "Cap_ProjectQty Is Null") > 0 Then

    tests if any record has a Null.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 7
    Last Post: 03-05-2016, 03:04 PM
  2. Adding new record to a table from a different form.
    By IncidentalProgrammer in forum Programming
    Replies: 5
    Last Post: 04-03-2015, 12:04 PM
  3. Replies: 2
    Last Post: 03-19-2014, 04:51 PM
  4. Replies: 4
    Last Post: 08-14-2012, 07:14 AM
  5. Replies: 1
    Last Post: 03-29-2010, 04:11 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