Results 1 to 8 of 8
  1. #1
    Jo Foster is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2016
    Location
    Alabama
    Posts
    3

    Making a button function like it needs to..

    Still rather new to Access, took an introductory course years ago but it's not helping. Been searching and reading through this forum, but I guess I just don't know exactly what I need to be looking for in order to find a thread that can help me.



    I'm created a database to verify winning sweepstakes tickets and I'm having trouble figuring out how to get a form button to lookup a specific ticket's prize. I'm in the beginning stages of starting to make some of the forms that will be used by the end-user . I've created a Verification form with 5 text boxes, 4 of them are based on the sweepstakes ticket numbering system which is broken down as follows;
    1. Game Number
    2. Game ID Number
    3. Game Ticket Number
    4. Game Ticket Ver Code

    and the 5th text box is where I would like the ticket's prize to show up.

    Function of the form:
    Once the 4 ticket number fields (as described above) are filled in and you click on the Verify button, It needs to; 1) make sure the numbers entered are a valid ticket number and 2) display that ticket's prize in the 5th text box. I'd also like to get a message box to pop-up if the numbers entered are invalid.

    So far all I have accomplished is getting the form to pop-up a message box if one of the 4 ticket number fields are left blank when you click the Verify button, clearing the fields with a Clear button and closing the form with a Cancel button.

    Can anyone help me with how to finish the programming of the Verify button's function? Any help would be appreciated.
    Attached Files Attached Files

  2. #2
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Just a thought.

    Create a query similar to qryvar which also shows the prize.

    Make sure the criteria are set to the four ticket values

    Then pressing the verify button could run the query and the record source of the txtprize could be filled in using a dlookup function.

    You'd have to allow for an empty query but I'm sure someone on here could help with that.




    Sent from my iPhone using Tapatalk

  3. #3
    Jo Foster is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2016
    Location
    Alabama
    Posts
    3
    I'll have to see if I can't do a little more research on creating such a query...
    Thanks for the idea.

  4. #4
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Click in the criteria box and look for the builder button. Then look in the expression elements for the text box you need.

    Best of luck.


    Sent from my iPhone using Tapatalk

  5. #5
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    There are a few ways, as usual. My preferred method would be to use the tblVer as the record source for the form. When they enter the serial number filter the form on that:
    Me.Filter="serialNumber='" & the_serial_number_entered & "'"
    Me.FilterOn=True
    Me.Requery

    This way all the other fields will be filled in, game, prize, etc.

    You also do a Dlookup and populate the prize that way.

  6. #6
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Maybe something like this:
    Attached Files Attached Files
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  7. #7
    Jo Foster is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2016
    Location
    Alabama
    Posts
    3
    Yes Bob Fitz, like that! Now all I need is to get the message box in there for any invalid numbers... I'd been trying to get this button programmed for days, Thank you, Thank you, thank you!

  8. #8
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Not sure what you mean exactly by "invalid number" but hope this is what you need:
    Attached Files Attached Files
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

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

Similar Threads

  1. Making Last Record Appear in Macro Button
    By wes9659 in forum Access
    Replies: 2
    Last Post: 04-14-2014, 01:34 PM
  2. Making a button disappear upon conditions
    By TatianaVBA in forum Forms
    Replies: 4
    Last Post: 02-20-2013, 01:51 AM
  3. Making a Public Function more flexible
    By sjs94704 in forum Programming
    Replies: 2
    Last Post: 12-10-2012, 02:21 PM
  4. making button image animated
    By chickenguru in forum Forms
    Replies: 0
    Last Post: 05-23-2012, 10:12 PM
  5. Making an inactive button Help
    By ericfatherree in forum Programming
    Replies: 2
    Last Post: 02-05-2012, 11:05 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