Page 2 of 2 FirstFirst 12
Results 16 to 28 of 28
  1. #16
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922

    Do you know how to put that code in the right event?

  2. #17
    sroy is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2013
    Posts
    34
    Worked.
    I have put another macro which I found my online search and kept under the above code.

    Now when I try to input in my input boxes it shows warning : If "Form1" is a new macro group, make sure you have saved it and that you have typed its name correctly.
    Is the two macro clashing ?

  3. #18
    sroy is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2013
    Posts
    34
    Its the other code which I kept below your macro code. Yes I know hoe to put the code[selected input box, then build event and inside code builder]
    Private Sub Command1_Click()
    Dim ctrl As Control
    For Each ctl In Form.Controls
    If TypeOf ctl Is TextBox Then
    ctl.SetFocus
    ctl.Text = ""
    End If
    Next
    End Sub

  4. #19
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Did you put that code in the Click event of a button on your form?

  5. #20
    sroy is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2013
    Posts
    34
    Yes RG I have put that code in the Click event of a button on my form to clear the text box inputs.

  6. #21
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Go ahead and post ALL of the code in your form's code module.

  7. #22
    sroy is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2013
    Posts
    34
    nope not working RG.

  8. #23
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Copy and paste your code module into a post so we can see what you have.

  9. #24
    sroy is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2013
    Posts
    34
    Private Sub Text2_BeforeUpdate(Cancel As Integer)
    If InStr(Me.Text2, "*") Then
    MsgBox "You are using and asterisk '*'", vbCritical + vbOKOnly
    End If
    End Sub

    Private Sub Reset_Click()
    Dim ctrl As Control
    For Each ctl In Form1.Controls
    If TypeOf ctl Is TextBox Then
    ctl.SetFocus
    ctl.Text = ""
    End If
    Next
    End Sub

  10. #25
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Try changing your button code to:
    Code:
    Private Sub Reset_Click()
       Dim ctl As Control
       For Each ctl In Me.Controls
          If TypeOf ctl Is TextBox Then
             ctl = ""
          End If
       Next
    End Sub

  11. #26
    sroy is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2013
    Posts
    34
    Thanks it worked. Well can I add the star macro code with the search button of the form so that instead of giving waring on entry let it show warning on clicking the search button.

  12. #27
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Have you tried it?

  13. #28
    sroy is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2013
    Posts
    34
    No not tried it. perhaps some if else may help not sure.

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

Similar Threads

  1. Validation Rules Help
    By Troop in forum Access
    Replies: 11
    Last Post: 03-05-2013, 01:26 PM
  2. Using Validation rules to restrict certain types of data entry.
    By Long Tom Coffin in forum Database Design
    Replies: 3
    Last Post: 07-23-2012, 10:38 AM
  3. Field rules/validation rules
    By sk88 in forum Access
    Replies: 14
    Last Post: 02-26-2012, 01:03 PM
  4. Textbox data validation rules.....
    By smorelandii in forum Access
    Replies: 1
    Last Post: 02-01-2011, 09:52 PM
  5. Validation Rules
    By esglover in forum Database Design
    Replies: 1
    Last Post: 07-23-2010, 08:02 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