Results 1 to 3 of 3
  1. #1
    Nokia N93 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    55

    help in supermarket database


    Hello Everyone
    i have to make a small database for a super market,, this supermarket has different customers who take goods from it ,
    i want a form to enter his name , his address, tel No., and i want records to store the total amount to pay, date of purchase , amount paid, amount remaining

    the supermarket wants a query to enter the name of the customer , and the whole records of purchases for the customer>
    but we don't want a dropdown menu, because there are many different customers \\\\ how can i do that ??

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,645
    An advanced beginner should understand basic Access functionality. Do you understand relational database concepts? Identify data entities and relationships, build tables, build forms, build reports. Forms and reports can use queries as data source. Why would you not want a dropdown menu (a combobox)? Even if there are a lot of customers a combobox will be useful.

    Review
    http://datapigtechnologies.com/flash...earchform.html
    http://datapigtechnologies.com/flash...tomfilter.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Parsonshere is offline Novice
    Windows 8 Access 2013
    Join Date
    Aug 2012
    Location
    Rusk
    Posts
    25

    Check Status

    This is a partial fix, referencing the query portion only.
    The query is the recordsource of the listbox.
    This listbox, textbox, command button should be on the form that has the recordsouce you want to locate the record in, if room is a problem, put a tab control on the form, and add controls to the pages.
    I would create a listbox, textbox, and command button.
    Just an overview of the expected results:
    In the textbox, type the first few letter of the serach field, probably last name.
    Then click the commandbutton, which will set the rowsource to alphabetically list names beginning with serachbox letters.
    Then Click the appropriate name in the listbox, and the event sets the focus to the record ID textbox on the form, then executes findrecord.
    Anomalies
    Remember with numeric field searches, you don't need the apostophe, but with alphanumerics or alpha fields you do need them. This is not the data, but the table's field type that determines this.
    The wildcard in Access is the asterik, not the % sign like in SQL.
    Alter the textbox, listbox etc, control names in any search field, to be sure the program knows whether you are addressing the field, or the textbox, or other control. Default textbox names are the field name. (ex: change textbox name from fldID to txtID)
    You may need to alter properties of the listbox. The wizard will step you through this, if you use it. In this case, there are two columns, the first is hid, which means you set column 1 to 0, that way the only see the name in the listbox.(see example below)
    column widths: 0";1"
    column count: 2
    bound column: 1 (the hidden ID field, which is the value of the default column)
    'Command Button Click Event
    'Note only two fields of the table are included in the rowsource, ID and fldNme.
    Private Sub cmdSr_Click()
    Dim x
    x = Me.txtSr
    With Me.lstVen
    .RowSource = "SELECT fldID, fldNme FROM tblNme WHERE fldNme like '" & x & "*' ORDER BY fldNme"
    .Value = .Column(0, 0)
    End With
    End Sub
    'Listbox Click Event:
    Private Sub lstVen_Click()
    Dim x
    With Me
    x = .lstNme.Value
    .txtID.SetFocus
    End With
    DoCmd.FindRecord x, acEntire, , acSearchAll, , acCurrent, True
    End Sub

    1. Add the commandbox, listbox, and textbox to the form.
    Place the textbox and command button side by side on top of the listbox.
    Also add the fields to the form from your table, as I guess you already have done.

    2. Rename the textbox so it won't be confused with the field name. The textbox is where you will type the first few letters of your name field for search.

    3. With the focus on the list box, right click the control and select the properties.
    The DATA Tab rowsource type should be Table/Query
    The FORMAT Tab should have column widths set to 0";1" (Increase the 1 as needed)
    The FORMAT Tab Column Count should be 2.
    The EVENT Tab onclick property should be set to event procedure
    then click the 3 dots to the right, to go to the form class module.
    paste the click event from the above post for the listbox.
    If you have duplicate sub and end subs, delete the ones from the post and leave the default since they reflect the correct control name.

    4. Right Click the command button, and get the properties dialog up for it.
    on the EVENT Tab, again select "Event Procedure" and then click the 3 button to the right to go to the class module.
    Set the Format Tab Caption to "Search"
    Paste the procedure within the sub and end sub that are already there. Delete duplicate Sub and End Subs (better, don't copy the sub and end sub statements to start with)
    Save the form, and try it out.
    Last edited by Parsonshere; 04-08-2013 at 01:58 PM. Reason: Clarity

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

Similar Threads

  1. Replies: 2
    Last Post: 01-28-2013, 04:42 PM
  2. Replies: 1
    Last Post: 01-16-2013, 12:40 AM
  3. Replies: 5
    Last Post: 05-16-2012, 12:48 AM
  4. Replies: 20
    Last Post: 08-08-2011, 01:34 PM
  5. Replies: 3
    Last Post: 05-15-2011, 10:52 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