# Database Discussions > Microsoft Access >  input forms

## BMan111

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

----------


## KnooKie

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.

----------


## BMan111

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.

----------


## KnooKie

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 ?

----------


## BMan111

[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.*

----------


## KnooKie

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

----------


## BMan111

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

----------


## KnooKie

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 ?

----------


## BMan111

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

----------


## KnooKie

Well this is the exact code on my form where i do this and it works great.



```
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 ?

----------


## BMan111

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.)

----------


## KnooKie

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.

----------


## BMan111

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

----------


## KnooKie

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.

----------


## BMan111

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

----------


## BMan111

For anyone that was following this post, KnooKie is a god and got it working. Anyone that would like to know how can ask me. email shouldnt be to hard to look up on here.

Oh, and KnooKie, did you ever know that your my hero?
You really are everything I wish I could be.
I think I could fly higher than an eagle, if you were the air resistance over the top of my wing.
 :Stick Out Tongue:  

Brandon

----------

