Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBSCRIPT for popup form

Status
Not open for further replies.

samusa

Programmer
Jan 1, 2001
107
US
Hi,
I have option buttons(Yes/No) on Data access page. If option No is clicked ,it stores NO value in "optno" field of tblstudent table.There is also a memo field in the table "NoComment". I want popup window/form to accept user comments and once he click on OK button, it should be saved to NoComment field.I would greatly appreciate your help


Sam
 
check out, inputbox()
and Update statement


varComment = Inputbox("What's your comment buddy?)

CurrentProject.connection.Exexcute _
"UPDATE NoComment Set txtComment ='" & varComment & "'
 
I tried it but it is giving me error(accdp://90045721)Here is the code that I used

Dim varComment
varComment =Inputbox("Please Enter your Comments")
currentProject.Connection.Execute_
"Update tblhistory Set tblhistory.Notes ='"& varComment &"'"



Sam
 
???? your underscore, needs a space, after ".Execute _"?

If not, try This;

Dim varComment, SQL

varComment = InputBox("Please Enter your Comments")


SQL = "Update tblhistory Set tblhistory.Notes ='"& varComment &"'"


Docmd.SetWarnings false
Docmd.RunSQL SQL
Docmd.SetWarnings True
 
Thanks for your reply. Both of them worked and poped up window. However they didn't save the comments in to the table. I modified run statement to MSODSC.Connection.Execute SQL, It is working however instead of storing comments only to the relevant student in Notes field it is saving comments for all students in Notes field.

Dim varComment, SQL

varComment = InputBox("Please Enter your Comments")
SQL = "Update tblhistory Set tblhistory.Notes ='"& varComment &"'"
MSODSC.Connection.Execute SQL

Could you please tell me how to save comments to relevant student.I am using StudentID as a primary key in this table.Also how can i increase size of popup window text box .Appreciate your help



Sam
 
I don't know how to increase size of pop-up, but
where will you get StudentID from. Are you working from
Student Form, with Bound Student Table?
If So;

SQL = "Update tblhistory Set Notes = '" & varComment & "' WHERE StudentID =" & Me.StudentID
 
when i use WHERE condition, it does not save at all. I tried to create another table and put StudentID as a foreign key over there. I used WHERE tblhistory.StudentID = tbltemp.StudentID.But all in vain.

Like I said in earlier post StudentID is primary key of history table and I have to associate Notes field with studentID.

Sam
 
where are you calling this form from?

Is StudentId numeric?

Is Me.StudentID, getting populated???

What do you get, when you do this MsgBox Me.StudentID
 
Ok ..I have created Data Access Page based on history table(tblhistory). On Data Access Page I have used Option button (Yes and No)used for student's attendance assessment. When a Supservisor is looking at student information page(Say StudentID 1) and click on No option. Popup window should appear and Supervisor should enter his comments and it should be saved to the same table(tblhistory.Notes) but associated with StudentID1.

If I am using above code without WHERE condition, It is working but is modifying all students Notes field with same comment.

Yes StudentID is numeric and Me.StudentID is not getting populated.



Sam
 
SAm, I don't know ASP.

All I can say, how do you get StudentID populated?
That's the key, how do you refrence the control?

This does not reference the control, Me.StudentID?

Tell me how to get the specific value, of the StudentID,
from the record you're on?
 
StudentID is already in tblhistory table and is entered into this table using INSERT INTO statement in VBSCRIPT.

Sam
 
WHAT IS THE UNDERLYING TABLE the ASP is ON???


Dim varComment, SQL As String
Dim intStudentID As Integer

intStudentID = ????
get this populated, & you got your answer.


varComment = InputBox("Please Enter your Comments")

SQL = "Update tblhistory Set Notes = '" & varComment & "' WHERE StudentID =" & intStudentID


MSODSC.Connection.Execute SQL
 
Excellent. This is working now. But how can i get value for IntStudentID? StudentID is entered to the tblStudent. It gets simulataneously saved in tblhistory table on which my current page is based on.Thank you for your help

Sam
 
I give up Sam.
I've asked you several times, to TELL ME, how to get it???

WHAT IS THE UNDERLYING TABLE the ASP is ON, tblSTudent???
 
then why does this not work;
Me.studentID???
 
Actually I am selecting studentID from dropdown combo box and his/her shows up rest of the page. This is the reason above code is not working. Is there a way I can put "studentID= selected StudentID in combo box" in Where condition.If i make it happen , above code will work fine.
Help Please

Sam
 
You are so vague with your explanations!!!!!
I"M GOING TO ASSUME YOUR COMBO IS BOUND TO THE FIRST COLUMN.
and your first column is Student ID, thus;

intStudentID = cboStudent.

or if not 1st column
intStudent = cboStudent.Column(1)'if 2nd column.
 
Combo is not on form. It is on Data Access Page and it is bounded to StudentID. When I select for example studentID 2 in combo, I need to get that value and put it against IntStudentID.

like intStudentID = & droplist1.value (Not working)

Sam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top