G
Guest
'I am attempting to pull data from a column in a query.
'I want to pull the last four numbers of the SSN of the individual selected
form
' the combo box on the form.
'1. The code I have written gives me the error " object required"
'This Sub will add the last four of the SSN and the row number of
'the personnel information being displayed to the Student_Info table
Private Sub UpDateSingleRecord_Click()
On Error GoTo Err_UpDateSingleRecord_Click
Dim num1 As Integer
Dim L4ssn As Integer
' This is where I get my error
' I am attempting to pull the data directly form the queries section
' This piece of code is excuted after I toggle the add record button
' The user will toggle the add record button after they view the displayed
info and
' determine it is individual they want to add to the table
num1 = InStr(1, Queries![DET1PERSONNEL1 Query]![SSAN], Chr(32))
L4ssn = Left(Queries![DET1PERSONNEL1 Query]![SSAN], (num1 - 1))
'This SQL statement will INSERT a single record into the Student_Info table
' The SSN path will be added here to complete the addition tot he record
' This SQL statement is to long for viewing on the screen with scrolling to
the
' right and it will grow longer
' 2. How can I do a contuniation on the next line without getting an error?
DoCmd.RunSQL "INSERT INTO Student_Info(STUDENT_ROW_NUMBER,CLASSNUMBER)
VALUES(
Forms![Course_Information]![ClassDate]![Student_info1]![STUDENT_ROW_NUMBER],Forms![Course_Information]![ClassDate]![Student_info1]![CLASSNUMBER] )"
DoCmd.GoToRecord , , acNewRec
Exit_UpDateSingleRecord_Click:
Exit Sub
Err_UpDateSingleRecord_Click:
MsgBox Err.Description
Resume Exit_UpDateSingleRecord_Click
End Sub
3. Is it more efficient to pull the data directly from the queries section
or more efficient to pull it from the form via the combo box?
4. if the latter is more efficient how do I state the path?
'I want to pull the last four numbers of the SSN of the individual selected
form
' the combo box on the form.
'1. The code I have written gives me the error " object required"
'This Sub will add the last four of the SSN and the row number of
'the personnel information being displayed to the Student_Info table
Private Sub UpDateSingleRecord_Click()
On Error GoTo Err_UpDateSingleRecord_Click
Dim num1 As Integer
Dim L4ssn As Integer
' This is where I get my error
' I am attempting to pull the data directly form the queries section
' This piece of code is excuted after I toggle the add record button
' The user will toggle the add record button after they view the displayed
info and
' determine it is individual they want to add to the table
num1 = InStr(1, Queries![DET1PERSONNEL1 Query]![SSAN], Chr(32))
L4ssn = Left(Queries![DET1PERSONNEL1 Query]![SSAN], (num1 - 1))
'This SQL statement will INSERT a single record into the Student_Info table
' The SSN path will be added here to complete the addition tot he record
' This SQL statement is to long for viewing on the screen with scrolling to
the
' right and it will grow longer
' 2. How can I do a contuniation on the next line without getting an error?
DoCmd.RunSQL "INSERT INTO Student_Info(STUDENT_ROW_NUMBER,CLASSNUMBER)
VALUES(
Forms![Course_Information]![ClassDate]![Student_info1]![STUDENT_ROW_NUMBER],Forms![Course_Information]![ClassDate]![Student_info1]![CLASSNUMBER] )"
DoCmd.GoToRecord , , acNewRec
Exit_UpDateSingleRecord_Click:
Exit Sub
Err_UpDateSingleRecord_Click:
MsgBox Err.Description
Resume Exit_UpDateSingleRecord_Click
End Sub
3. Is it more efficient to pull the data directly from the queries section
or more efficient to pull it from the form via the combo box?
4. if the latter is more efficient how do I state the path?