HELP! Display a query result into form

leanne

New member
Local time
Tomorrow, 03:39
Joined
Jun 16, 2010
Messages
7
Dear All,

Good Day! I need your guidance to solve this problem. I have been stuck for 2 days already.

I am having a form and the record source is link from a table called tblTask.
tblTask keeps many different field and many different date.

In the form, after I enter the Start Date and End Date for the task, the system should show me the Workdays.

The Workdays will come from query, qry3. After I did some calculation.


Now, I manage to query the workdays for a particular task already, but I don't know how to show the result into the form.
Besides that, there will be more than one fields which need to display the result from different queries, so I cannot link the form to a query.

I have tried to use the DLookUp method but it show the error 2001.

I am attaching with my sample code and I really hope you all can help me to solve this problem.


TQVM!
 
Can anyone please help me?!?
I still have 2 more calculations for another 2 different workdays in the same master form.


A silly question, can I use a subform / form that link the record source with the query, then reflect it back to my master form?!?
 
Did you open the database I attached to your first post???
 
Hi, PNGBill.

Sorry, can I know which one?
Do you mind to re-post to me again?!? TQ!
 
i just changed your form and added the subform.

Let me know if this is what you are after.

here it is>>> not zipped as very small anyway.
 

Attachments

I received the database. TQVM!

However, you just show the query result in a subform - listing format only, but not reflect the result back to the form text field (txtWorkdays)

That is not I want... I need to show the result in the txtWorkdays.
 
Which result.??

Tell me the exact figure you want displayed and I will try and get this to happen.
 
I am still working on that part. Here is my temporary workout.
(Plz refer to the attachment - image1.jpg)



Now, when I move to record 2, the txtWorkdays cannot move. :(
 

Attachments

  • image1.jpg
    image1.jpg
    35 KB · Views: 286
  • Task2a.zip
    Task2a.zip
    48.5 KB · Views: 198
I am sorry Leanne but it should work.

You have the main form and the subform shows the text box control TotalWorkday which you want to display in your unbound text box on the mainform.

Entering =[Forms]![SubFrmQry3]![TotalWorkday] in the ControlSource of your mainforms text box should get it to display the data that is also showing in the subform.

If it can work then you just make the subform not visible and you have your problem solved.

If a more experienced member can resolve then good otherwise, you can remove the lines etc from the subform and make it appear to be invisible except for the data you want to see.
 
Thanks for trying to solve the problem for me.

I have tried to enter =[Forms]![SubFrmQry3]![TotalWorkday] into control source for the txtWorkdays. However, when I run the form, it shows #Name?


Then I try to put this code into Code Builder. That is why the subForm result cannot move.

Private Sub Form_Load()

txtWorkdays = Me!Child6.Form.TotalWorkday

End Sub


I am thinking like that too. If I manage to show the result from subForm - TotalWorkday into txtWorkdays, then I dun mind to use 3 subForm to keep 3 different records in a same master form.


Anyone can help me??? Plz.........


So sorry, I forgot to post the testing result.

OK, thanks for your reply. I will try to play around with it.
 

Attachments

  • image2.jpg
    image2.jpg
    36.8 KB · Views: 305
Last edited by a moderator:
Maybe your qry is not giving the correct data.
 
You will have to rethink what you are doing with your database.
If your query returns the wrong data then your form will never display the correct data.

Your tables don't make sence which doesn't help your queries.

Try and describe what you are attempting to achieve and with what basic data.

I am sorry if your time is short but you just don't have the basics right and no amount of head scratching can change that.
 

Users who are viewing this thread

Back
Top Bottom