Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: input forms

  1. #1
    Join Date
    Jun 2003
    Location
    Bloomington, IN, USA
    Posts
    116

    input forms

    I am working on input forms for my database atm. While I feel I am making progress, my boss does not think so and is rushing me more than a little. He wants the input forms to work as follows:

    1. select the project number
    2. modifiy that project

    However, I am noticing that when you bring up the form it just rests on record one, which only changes the information in that record, not the one with the matchign project number.

    Everythign thing I have tried to accomplish on my own as far as selecting the propor form has infact crashed said form.

    Does anyone have any advice for me at all?

    Brandon

  2. #2
    Join Date
    Jan 2003
    Location
    UK
    Posts
    277
    have a combo box in the form header with a list of projects in it but bound to the project ID.

    On the afterUpdate event of this combobox you put something similar to....

    Me.Filter = "ProjectNumber = " & Me.ComboboxName
    Me.FilterOn = True


    This will filter the form to whichever projectID you choose in the combobox.

    I assume the projectID is in the query that your form is bound to.

    Depending on your form needs you may have to also requery comboboxes on the form in the afterupdate event ??

    To unfilter and get back all the records click the depressed filter button oon the button bar menu.

    P.

  3. #3
    Join Date
    Jun 2003
    Location
    Bloomington, IN, USA
    Posts
    116
    is 'Me' supposed to represent the form in question? Because its telling me it doesnt recognize the macro name. So I tried it with [forms]![frmNotes], which it didn't seem to like either. Yet one more thing on the list of things im ignorant about in Access.

    Brandon

    PS thanks again for your help, I see why/how it works, its just the one syntax problem I'm having.
    Last edited by BMan111; 06-16-2003 at 01:41 PM.

  4. #4
    Join Date
    Jan 2003
    Location
    UK
    Posts
    277
    exactly right about your Me description. It's a shorter and slightly faster way of referencing the immediate form.

    I took this code directly from one of my databases and just changed it to suit your ProjectNumber DB.

    The project number part of

    Me.Filter = "ProjectNumber = " & Me.ComboboxName


    is the name of the project number field on your form which may be different to what i called it ?

  5. #5
    Join Date
    Jun 2003
    Location
    Bloomington, IN, USA
    Posts
    116
    [ProjectNumber]is right, but I'm still having the problem with the Me. looking for a macro, which its doing as well when I put in [forms]![frmNotes] reference.

    Brandon: *screams 'STUPID COMPUTER!!' as he draws his katana and cuts the infidal machine into many many small pieces.*

  6. #6
    Join Date
    Jan 2003
    Location
    UK
    Posts
    277
    when you enter the dot(.) after Me does it give you a list of reserved words and fields to choose from ? It should do and the combobox should be in the list somewhere ?

    I guess that's not happening though. And sadly i'm not sure why ?


    Are you definitely in the AfterUpdate event ? Silly question but all i can think of.

    GL

  7. #7
    Join Date
    Jun 2003
    Location
    Bloomington, IN, USA
    Posts
    116
    nope, its not bringing up any kind of a list, but it never has. And yes, I am in the AfterUpdate event. This is a stupid question, but worth asking i think, Is that chunck of stuff for VBA? cus if it is IT doesnt allow me to have VBA.

    Brandon

    Check that, I just talked IT into putting the VBA stuff on my machine. Here is the entire function as it sets on my form, but it don't work:

    Private Sub ProjectNumber_AfterUpdate()
    'Me.Filter = "ProjectNumber = " & Me.ComboboxName
    Me.Filter = "Project_Number = " & Me.ProjectNumber
    'Me.FilterOn = True
    Me.FilterOn = True

    Me.Requery

    End Sub.

    While this doesnt give me an error, it just doesnt do anything
    Last edited by BMan111; 06-17-2003 at 03:49 PM.

  8. #8
    Join Date
    Jan 2003
    Location
    UK
    Posts
    277
    It looks the same as mine where i use it ? Hmmmmmm

    Don't think you need the Me.requery bit though.

    How have you set the rowsource for your combo box ?

    Do you have 2 columns with column 1 being the project number ? Is column 1 the bound column ?

  9. #9
    Join Date
    Jun 2003
    Location
    Bloomington, IN, USA
    Posts
    116
    There is only one column in the second combo, Project_Number.

    If i run it as you have it it does nothing but stare at me blankly in the face. However, if i do it as follows it does do something, not what I want it to , but something. It basicly deletes anything not in the header and/or footer and it becomes a blank gray panel.

    The code that does something is :
    Me.Filter = "Project_Number & " = Me.ProjectNumber

    I am so glad I took those anger managment courses, otherwise this computer would be well and truely gone. And I truely appreciate all your help.

    Brandon

  10. #10
    Join Date
    Jan 2003
    Location
    UK
    Posts
    277
    Well this is the exact code on my form where i do this and it works great.

    Code:
    Me.Filter = "fi_plcCode = " & Me.cboSearch
    Me.FilterOn = True
    without seeing it i don't know what else to suggest i'm afraid ? The combo is definitely bound to column 1 (the project number) ?


    There is only one column in the second combo, Project_Number.
    You have 2 combo boxes !? Are they both in the header ? What does the one that doesn't have the project number in it do ?

  11. #11
    Join Date
    Jun 2003
    Location
    Bloomington, IN, USA
    Posts
    116
    They are both in the header, and the first one has a year in it:
    You drop it down, select a year, then in its after update it requeries the ProjectNumber box.
    The ProjectNumber box, which is based off a queary that determines what project numbers are from the year you selected, contains the Project_Number that the whole db is based around.

    make sense? ... No? ... Me either.

    But it doesnt look as if the control, ProjectNumber, is bound at all. When ever I try to bind it to the forms Project_Number field, it makes it so I cant make selections from the ProjectNumber control. I can scroll it, but the value in the box doesnt change.

    I really wish I could just email it to you, but I'm guessing my boss wouldnt like that Idea to much, you know, that whole senesitive data thing. (Hey, >I'm< not the one that thought it would be a good idea to use actual data as test data.)

  12. #12
    Join Date
    Jan 2003
    Location
    UK
    Posts
    277
    The first bit sounds fine.

    But it doesnt look as if the control, ProjectNumber, is bound at all. When ever I try to bind it to the forms Project_Number field, it makes it so I cant make selections from the ProjectNumber control. I can scroll it, but the value in the box doesnt change.
    The projectNumber combo box Should be Unbound. This is because the project number field on your form is (or should be) bound to the project number in the query behind the form.

    The combobox should have its bound column property set to 1 though and also its column count set to 1.


    If you did want to email it to me you could always take a copy and remove the data from it first.

  13. #13
    Join Date
    Jun 2003
    Location
    Bloomington, IN, USA
    Posts
    116
    You are correct, both the box and the field are set up how you say.

    And unfortunatly I cant email it, firewall doesnt allow attachments to go out unless a manager ok's it first. I really feel like my brain or my job is about to pop.

    Ok, let me try to rehash: (and at th is point im just thinkin out loud)

    The code chunck you gave me works in yoru DB, but not mine.

    Every site I have been to has has more or less an identical code chunck to what you have.

    I have it translated correctly for my DB, it just doesnt work.

    In your code, do you have a DAO object declared anywhere? This is the only code in my entire project, and as such none of that kind of thing has been declared. Though all of the DB objects have all of their reserve menu items.

    This is both retarted and stupid. Somethign this common should NOT be this hard. Maybe I'm just really that bad.

    Brandon

  14. #14
    Join Date
    Jan 2003
    Location
    UK
    Posts
    277
    I have a reference to Microsoft DAO 3.51 object library

    and also to Visual Basic for Applications.

    Have you checked your references ?

    Go into some code and click on Tools > References and see what is ticked.

  15. #15
    Join Date
    Jun 2003
    Location
    Bloomington, IN, USA
    Posts
    116
    Ok, that is not working at all, and the machine has decided it isnt goign to. I am goign to go another direction, I just havent decided how. Is there a way to do it through Macros? Would it be possible to run a VB loop through all of the records looking for the one that matches and then returnign its record number to the form? Or is that just to much work?

    Brandon

Posting Permissions

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