This topic is locked
[SOLVED]

 Auto Populate field using Custom

11/21/2009 8:56:40 AM
ASPRunnerPro General questions
W
wisdom2009 author

Hi,
Hope everyone is doing good!!!
I'm hoping if some could help me with this. I am trying to auto populate a field depending another field. some of you will say that i can use the look up wizard, it is true but what i am trying to do is diffirent.
I will have 4 fields as below :

  • Date : (Get Date())
  • User Name : (Read only auto populate using custom)
  • Issue : (Look up Wizard)
  • Exception Time: (Look up Wizard)
  • Hours Worked : (I need to use Custom)


The last fied Hours Worked i would like this field to be populated using another table that will have Date, username, userID and hoursWorked i would like to match the date from the table to the date the users added in the form and the userID which is the logonID to populate the hours worked. i am not sure how to do that in Custom
Please any help will be appreciated

C
clig 11/23/2009



Hi,
Hope everyone is doing good!!!
I'm hoping if some could help me with this. I am trying to auto populate a field depending another field. some of you will say that i can use the look up wizard, it is true but what i am trying to do is diffirent.
I will have 4 fields as below :

  • Date : (Get Date())
  • User Name : (Read only auto populate using custom)
  • Issue : (Look up Wizard)
  • Exception Time: (Look up Wizard)
  • Hours Worked : (I need to use Custom)
    The last fied Hours Worked i would like this field to be populated using another table that will have Date, username, userID and hoursWorked i would like to match the date from the table to the date the users added in the form and the userID which is the logonID to populate the hours worked. i am not sure how to do that in Custom
    Please any help will be appreciated


You could build a second page that would be called in after save - so you could actually store worker queries for reference and use those values to pull up a summary page that includes "hours worked"

W
wisdom2009 author 11/23/2009



You could build a second page that would be called in after save - so you could actually store worker queries for reference and use those values to pull up a summary page that includes "hours worked"


I did created a second page and i used it in the look up wizard to match the date added in the from to the the date in the view that will pull the hours worked i did add where clause in the lookup wizard where the userId = session(userid) and with no luck
Now my question. Can i add where clause in look up from to say Where USERID='" & Session("UserID") & dtDate = dtExceptionDate (this is the date that will be entered in the form.

C
clig 11/24/2009



I did created a second page and i used it in the look up wizard to match the date added in the from to the the date in the view that will pull the hours worked i did add where clause in the lookup wizard where the userId = session(userid) and with no luck
Now my question. Can i add where clause in look up from to say Where USERID='" & Session("UserID") & dtDate = dtExceptionDate (this is the date that will be entered in the form.


need an event to capture antyhing selected or typed - real-time would likely need some custom asp to capture a form field change

W
wisdom2009 author 11/24/2009



need an event to capture antyhing selected or typed - real-time would likely need some custom asp to capture a form field change


Thank you for your reply. Do you have an example??

W
wisdom2009 author 11/24/2009

Hi,
I did add a custom code to populate field depending on the user logged in and the Date entered by the user in the form but i received the following error :
Microsoft VBScript runtime error '800a000d'
Type mismatch: '[string: "select dHours from "]'
/Communications/databases/leader/include/aspfunctions.asp, line 2194
below is the code i used and also what i am trying to do
Name of the field in the form is dtexceptionDate. let say the user add the date manualy like 11/24/2009 the code below will match the date in the form that the user entered to the date in the view rpt.vwHoursLoggedin and also the userid in the view to the userid logged in to populate to correct hoursworked. if the user change the date the hours should change automaticcaly and there is no matching date in the case will populate 0.
Code :
str = "select COALESCE(dHours, 0) AS dHours from rpt.vwHoursLoggedin where USERID='" & Session("UserID") & "'" AND dtDate = session("dtexceptionDate")
Set rsTemp = server.CreateObject("ADODB.Recordset")
rsTemp.open str, dbConnection

Session("dHoursWorked") = rsTemp("dHours")
rsTemp.Close : set rsTemp = Nothing

W
wisdom2009 author 11/29/2009

Any Help???

J
Jane 11/30/2009

Hi,
what event do you use for this code?

W
wisdom2009 author 11/30/2009

Hi,
I was able to use the Lookup wizard by using the drop down is depending on another one. since my drop down is depending on the date, i have an issue that when i change the date the drop down does not refresh. is there a way to refresh every time the date is changed??

J
Jane 12/1/2009

Hi,
I'm not sure that I understand your question.

This code is executed when Save button is clicked. Unfortunately there is no way to update field based on the selected date on the fly.

W
wisdom2009 author 12/1/2009



Hi,
I'm not sure that I understand your question.

This code is executed when Save button is clicked. Unfortunately there is no way to update field based on the selected date on the fly.


Is there a way to refresh the page and keep the same record entered??

J
Jane 12/1/2009

Unfortunately no.

W
wisdom2009 author 12/1/2009

Jane,
Thank you for your support. I did figure out a way how to populate the values based on the date. Before i was using the field date as a date that user can add manually . I changed that to Lookup wizard but using the same table to pull all distinct date and based on that value selected the HoursWorked field will change automatically and it did work.
Thank you again