Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2005
    Posts
    8

    Angry Unanswered: Help!!!!!!!!!!!!


    I am a new user to MS ACCESS, I know Visual Basic code, but that is very very different from this MS VB... I need help to search. I need a very basic explaination, code for to help me. I have Ms Access 2000, with access to MS VB Code only. I have set up a database called Wildlife. I would like to serach different ways. the 2 main ways are to have a listbox display the observers and have the ability to click on one of the names, and display that particualr persons records in a listbox and a subform that will display the records like design view. Also I would like to be able to enter the name in a text box and then search the database and then display the information in the same way. If anyone can help that would be very great. thanks


    You can private message me if you would like

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    if you design your main display form, identifying waht ever it is you wish (the form wizard does most of the donkey work, choose 'continuous forms' if you want a semi spreadsheet style form.

    the insert 2 unbound combo, or list boxes, your choice into the forms header of footer sections. agin there are wizards that will help you select the control, fill in the data source

    then you need to place some code behind each of the combo boxes on click events. so that when you select an itme from the list box it will then requery the forms data source and limit to the values you want

    the code should read something like

    me.filter="observerID = " & cmbobserver
    me.filteron=true
    Or
    me.filter="animalID=" & cmbanimal
    me.filteron=true

    if you wanted to restrict to filters from both combo boxes then you need to do a bit more code

    you can always turn a filter on using the symbol that sort of looks like a modern water tower or 'Y'
    you can alsoe use the select by example or form criteria, allowing your users to set and remove their own filters as they wish. for example they may wnat to limit to a particaular day, or particaulr species of animal

  3. #3
    Join Date
    Feb 2005
    Posts
    8
    Thanks for the help, but this is what I was afraid of.. I dont have one clue what that code is suppose to mean, so how am I suppose to add it to my code, and I dont understand what you are talking about :
    QUOTE "if you design your main display form, identifying waht ever it is you wish (the form wizard does most of the donkey work, choose 'continuous forms' if you want a semi spreadsheet style form."
    What the heck does this mean?? I dont have a clue? You must be using a different version of access cause I dont have that? well at least I cant find it....

  4. #4
    Join Date
    Feb 2005
    Location
    The Hague, Netherlands
    Posts
    95
    Quote Originally Posted by NewfieSarah
    Thanks for the help, but this is what I was afraid of.. I dont have one clue what that code is suppose to mean, so how am I suppose to add it to my code, and I dont understand what you are talking about :
    QUOTE "if you design your main display form, identifying waht ever it is you wish (the form wizard does most of the donkey work, choose 'continuous forms' if you want a semi spreadsheet style form."
    What the heck does this mean?? I dont have a clue? You must be using a different version of access cause I dont have that? well at least I cant find it....
    Haha I recognize this, always the same when you know a bit of one language/program and then wanting to learn another language/program, especially some Microsoft-"we'll decide what's good for you"-software.

    I've started Access 6 weeks ago, and I have my first application running. It took me 4 weeks to build it, then it totally crashed, and then I rebuild the same thing in less then one day. So I think I'm starting to get the hang of it.

    I'll try to tell you how I think Access works, maybe it helps.

    Access is a database/GUI-programme combined, meaning, you can design databases, but you can also created user-friendly interfaces to let other people use the data in the databases (without them having to actually see the db).

    The most important things I found in Access are the TABLES, FORMS and MODULES(I assume you are able to find those ;-)). Tables are what it says: Tables. A collection of tables make the database.

    A form is the same as in VB (I'm not totally familiar with VB but I think it had forms too): The 'platform' on which you place the different items that will make your GUI(Graphical User Interface): Buttons, Dropdownboxes, textfields etc.

    A module is the place where the code is stored. I untill now only use the class module where I code everything.

    Another important thing to know is that Access has two 'modes' of viewing of your project: 'Design mode' and 'view mode'. When you start a form, its default in 'view mode', which means its 'running'. You do the designing in the 'design mode', obviously. Find the buttons for this.

    Say you have placed a button on your form, and you want something to happen when you click this button. Be sure you're in design mode, right-click the button and click 'create event'. The code window will open. Here you can put ALL your code for ALL your buttons/dropdowns whatever.

    Access gives a lot of options to automate a lot of things, as microsoft always does. FOr instance, when you create a dropdown-list, you could use the access-wizard for making a dropdown-list, and assign a table-column to it. I recommend you do NOT use this, but code EVERYTHING in the class module. I messed up my database because I used some wizard-made comboboxes without really knowing what was happening and before I know it, changes were made to the data and I was screwed.

    In the class module, you can code every element. You can write code to be executed when clicked on a button, you can write code to be executed when some value is selected in the dropdownmenu, you can write code to be executed when the form is loaded. I dont know if VB has sub-routines and functions, but I assume so, and these are available here too.

    What you want is not really beginners, I'm afraid. To REALLY use databases well (and thats what you want) you need to be able to use SQL-statements. These are not hard but a bit different and I am not as advanced that I can help you with this (one of the things I need to dig in to).

    To make a listbox to display observers is rather simple: Just create (drag n drop) a combobox on your form, cancel the wizard, rightclick the button and select properties. Give the combobox a name you can use, I usually use DDname (dropdown-name). Then, rightclick the top of the form and select 'create event'. You should be able to open the class module now, where you can write your code. The following code should be after "Private Sub Form_Load()" (If it wasnt made automatically, do it by hand).

    DDname.RowSource = "SELECT [tblObservers].[Observers] FROM [tblObservers]"

    With this, the row source of the dropdown (say the source where he will get the data to display) will be set to the above SQL-statement. In this case, it will select the column 'observers' from the table 'tblObservers'. CHeck it in 'view mode' to see if this works.

    After this, you want something to happen when you select one of the observers from this dropdown. You can rightclick to dropdownbutton and select 'create event' again. Then, make something like this:

    Private Sub DDName_BeforeUpdate(Cancel As Integer)

    Dim User As String
    Dim usrID As Long

    User = DDname.Value

    Call GetMainIDFromTable(User)
    usrID = GetMainIDFromTable(User)

    End Sub


    This code will run when the dropdown is 'updated'. DDname.value reads out the value (in this case a name, a string) which the user has selected from the dropdown. In this code, I use the value to call a subroutine I created (GetMainIDFromTable(User), which will also be coded in the same class module), and this subroutine for instance, sets the rowsource for another dropdown.

    This is in very short the line of thinking you should have for Access. Hm, I'd better refer to some REAL tutorials:

    http://www.functionx.com/access/
    http://cma.zdnet.com/book/masteringaccess/index.htm
    http://mis.bus.sfu.ca/tutorials/MSAccess/tutorials.html

    gl

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •