Form Start Up

Beany

Registered User.
Local time
Today, 14:59
Joined
Nov 12, 2006
Messages
155
Hi,

Looking at my attached database, firstly when i load the form 'AssetMain' i would like the textbox Text20 to be empty until i select someone from the subform or from the comboboxes????

When this form is loaded textbox Text20 automatically has info in it..

Secondly, textbox Text18 should show the number of items each person has.. i cant get this working????:confused:

Can someone please have a look?

thanks in advance
 

Attachments

Looking at my attached database, firstly when i load the form 'AssetMain' i would like the textbox Text20 to be empty until i select someone from the subform or from the comboboxes????
When I open it, the textbox is already empty. What does it say when you open it?
Secondly, textbox Text18 should show the number of items each person has.. i cant get this working????:confused:
The number of items each person has? I don't see any such data in your tables. Looks like each person has one item. Is that right? If you want, you can simply add a 3rd column to the "User" control in the subform and specify that column as the controlsource for text18 on the event in which the requery action takes place.
 
Hi Beany,

For the first part of your question.
Delete the control source form TEXT20,
and add this to the the "On Current" event procedure of you subform

Code:
Forms![AssetMain]![Text20] = txtCountUser

For the second part of your question,
Put this into the Control Source of Text18

Code:
=Asset_subform.Form.Recordset.RecordCount

Hope this helps,

Garry
 
Amend the first part change it to "On Click" of the subform or the "On Click" event of each field in your subform instead of the "on Current"
 
when i open the textbox TEXT20 i get the following info Wayne Rooney Site Essex.. the first person in the subform list... strange??

The number of items each person has? I don't see any such data in your tables. Looks like each person has one item. Is that right?

Sorry mate, but what i mean by this is, if i select a user from the comboboxes it displays the items in the subform below...eg so if a user had 6 things in the subform then that should be displayed in the textbox TEXT18..

At the moment each person does have one item because i havent included more items yet..

If you want, you can simply add a 3rd column to the "User" control in the subform and specify that column as the controlsource for text18 on the event in which the requery action takes place.

Ive tried this but i couldnt get it to work..??!!
 
Thanks Zigzag for your response:

But I couldnt get both of the codes to work:

On Click:
Code:
Code:
Forms![AssetMain]![Text20] = txtCountUser

For the second part of your question,
Put this into the Control Source of Text18

Code:
Code:
=Asset_subform.Form.Recordset.RecordCount
 
Beany,

Don't take this the wrong way, but your form really needs to be restructured...

In Text20, you just want to view the name of person that holds the asset, correct?

Also, you said that you want to view the ID in Text18 after you select a user (an item holder), correct? You have the code present in the AfterUpdate event of the User combo box, and the control source IS set to the ID field of the Asset table. But the problem is that the main form does not have a recordset. Your code does not work, because there is no field ID found in the recordset (which doesn't exist).

Another question too, in Text20, why is the controlsource set to equal a control on the subform? Are you trying to list the name in that box no matter what combo the user picks from? Just wondering....

This should not be tough to fix. Somebody could probably help you with it, but you'd need to explain a little more about what purpose the 2 forms are supposed to serve. I anticipate that the purpose might be just to search on different criteria, and then have the results listed in the subform below, just for extra detail. It really looks like a typical search type form to me. Is that what you're trying to do here?
 
Last edited:
Beany,

Don't take this the wrong way, but your form really needs to be restructured...

In Text20, you just want to view the name of person that holds the asset, correct?

Also, you said that you want to view the ID in Text18 after you select a user (an item holder), correct? You have the code present in the AfterUpdate event of the User combo box, and the control source IS set to the ID field of the Asset table. But the problem is that the main form does not have a recordset. Your code does not work, because there is no field ID found in the recordset (which doesn't exist).

Another question too, in Text20, why is the controlsource set to equal a control on the subform? Are you trying to list the name in that box no matter what combo the user picks from? Just wondering....

This should not be tough to fix. Somebody could probably help you with it, but you'd need to explain a little more about what purpose the 2 forms are supposed to serve. I anticipate that the purpose might be just to search on different criteria, and then have the results listed in the subform below, just for extra detail. It really looks like a typical search type form to me. Is that what you're trying to do here?

ajetrumpet, thanks for your input...

Ok sorry for any confusion,


I kinda admit my forms a bit all over the joint :o

Let me explain, I want to make a selection from one of the comboboxes Filter by User, Filter by Department or Filter by Location so it shows the associated items in the subform.

The info in the subform is extracted from the tables..

The reason why i want a subform in the form Assetmain is so that the info can be edited via the subform. If this makes sense...and i prefer it like this...it looks good :D

In Text20 i want to view the User, Department and Location info (see in subform)..so for eg: if i click on one of the rows randomly in the subform it should put the User, Department and Location of the selected row in textbox Text20.

To get this working, ive tried a few things with my database and this has led to having code that doesnt make sense. Basically Textbox Text18 should show the number of items a User has..eg if Wayne has 6 items in the subform, Text18 should show the number 6...

The code present in the AfterUpdate event of the User combobox is wrong, sorry for the mistakes..i was exploring :confused: The ID field is present in the subform but is hidden, you can view it by extending the column size..

Ive been trying to work this out for quite some time now and i cant get it to work so i decided to post my database here for someone to have a look at..

hope this makes sense....
 
Hi Beany,

If you followed the suggestions I gave you at the beginning you would have it done by now......

Here is what you have asked for.

Garry
 

Attachments

Hi sorry Zigzag, was going to try it later..

looking at your attachment Text20 and Text18 in AssetMain displays nothing when i select a user from the comboboxes???

sorry to be a pain
 
Click on the record selector of the subform and it will display that record in Text 20.

Text 18 will show the count of the Records in the subform.

Garry
 
Click on the record selector of the subform and it will display that record in Text 20.

Text 18 will show the count of the Records in the subform.

Garry

thanks so far,

zigzag, Text20 doesnt show anything when i select a user from the combobox? (it does work by selecting it on the subform)

Text18 doesnt display any info but i have an error #Name??
 
Hi Beany,

This should now work with the combo box's, Checks this is working and then get back to me with the Text18 issue.

Garry
 

Attachments

Well,

If anyone is interested, here is the solution I came up with.

In this file, everything works except the "Number of Items" box. The reference I have in the OnCurrent Event works for every one of my databases, and I don't quite understand why it doesn't work here. But anyway, Beany, if you're going to look at this, I put all of your code into a module so it didn't get erased, and I added all the code (which wasn't much!) that is needed to the two forms' events. You can look at if you like.

And by the way, I think it's about time that I chime in with this little statement...

Most of the problems with technology (that I have seen anyway) are brought on by users who, quite frankly, don't know what in the world they're doing. It is because of this phenomenon, that there is no quick fix to a problem, especially yours Beany. Another good point...anyone who tells you otherwise would probably be better off talking to a doorknob. At least their words would be put to good use by doing that! ;)

In short, working with any kind of technology, especially complex software, takes a long time to learn and digest. The form you have now is OK, but getting all the pieces of code and objects to work together was the problem.

Another thing I should I point out is that questions that are not fully detailed (with all relevant information) on the original post are less likely to be answered successfully. If you don't know what information is relevant, the best thing to say is "I want "X", and I don't know where to start". That way, if someone replies, they will know (if they are the least bit competent, that is), at least, how to get you started, even if they don't fully understand the complexity of the solution needed. That is a general note, and one that can surely solve a lot of problems that build up during the course of a conversation that are not present before the conversation even begins.

Anyway, if you're interested in what I've put together, you can have a look see. The only thing this doesn't do, is filter the subform appropriately if a user wants to search on more than one combo box. I didn't think you were asking that, but if you were, you will have to expand on this. Let me know what you think...

One more thing, the explanation you gave to me after I asked the questions that I did was EXCELLENT!! That is clear cut, gives all the details needed, and will get you a COMPLETE answer to your question. Who knows, by asking it that way, somebody might even help you rework your issues, like I did. :)
 

Attachments

Last edited:
Well said Adam,

But I do believe that sometimes people need to get "what they want", just to realise that "what they want" is not always "what they need".

Learning by mistakes can be a good learning experience sometimes.

Garry
 
Last edited:

Users who are viewing this thread

Back
Top Bottom