Problem with my survey database

safeas

Registered User.
Local time
Today, 15:11
Joined
May 27, 2008
Messages
16
Hi I used a sample survey database I found on here: http://www.access-programmers.co.uk/forums/showthread.php?t=45298

I modified it to fit my criteria. Everything goes ok until it comes storing the student ID in the results table. I can create new student accounts, but when I log into the database it just assumes its one and the student ID comes up as 0. Can anyone see where im going wrong? thanks.
 

Attachments

Hello ICL!

Here it is, I made more changes. It is OK now.
 

Attachments

I forgot, in frmStudents, List0, List4, List2 (combo boxes), put
YES in LIMIT TO LIST properties.
 
Its still not working. Sorry I dont think im been to clear. I can create an account, but after filling out the questionnaire the question ID is correct, and the Answer is correct, but the studentID always appears as "0", and if I go to take the survey with a new account, its just edits the studentID "0" results, doesnt create new records in tblResults. Check the attachment of tblresults.
 

Attachments

  • tblresults.jpg
    tblresults.jpg
    15.1 KB · Views: 201
When you write the record in "tblResults" ??
When you open the form "frmSurveyAnsvers" ?
What are the fields "QuestionID", "Result" (in this table)?
 
tblResults stores the questionID, and the studentID. frmSurveyAnswers is a subform containing options each representing a value/result(1=Strongly Agree, 2=Agree, 3=Neutral etc) inside tblSurvey which displays each question. So in tblResults after I answer each question it will store QuestionID, and the result (strongly agree, disagree etc) but I cant get it to store the studentID
 
I made something as I think it must be.
I added a "frmStudentqueRes" as a subform in a "frmStudent".
I added a "tblAnswer".
Open frmStudent and try.
 

Attachments

Thanks for the help but its still not working. It has to be something to do with the coding for the the login form. Its not placing the StudentID from the login form into the studentID on the survey form.
Globals:
Option Compare Database
Public intStudentID As Integer

Function:
Option Compare Database
Public Function InsertStudentID() As Integer
'Place the intStudentID var into this function for placing on survey answers table
InsertStudentID = intStudentID
End Function


Option Compare Database
Private Sub cmdLogin_Click()
'Login
If IsNull(cboUser) Then
MsgBox "Please select a StudentID!"
Exit Sub
Else
'Place studentid into public variable
intStudentID = cboUser
DoCmd.OpenForm "frmSurvey"
DoCmd.Close A_FORM, "frmLogin"
End If
End Sub
 
Ok I found out my problem, I needed put place =InsertStudentID() function into default value for StudentID on frmSurvey.

Thanks alot for the help Stef
 
Ok I thought that had solved the problem but it hasent. I can create the first student account, take the questionnaire for the first time, and everything is stored successfully in the results table.

Now, when I go to create another student account, again that works ok, but I go to take the questionnaire with that account and it doesnt add the results to tblResults.

Anyone help me here ?
 
Hello safeas!

For "StudentID" look at attacment (word, zip).
You don't need a function for this.
 

Attachments

Users who are viewing this thread

Back
Top Bottom