Good afternoon everyone. I am brand new to all of this -- I haven't even played with programming in more than 20 years. Anyhow, if y'all can help me out, I would appreciate it. I have created a form that upon opening asks the user to select a campus. They then need click the "OK" button. Upon doing so, a new form ("Campus_Select") should open up on the particular record selected. At this point, upon clicking on the "OK" button, the user gets the following message:
Run-time error '3075:'
Syntax error in string in query expression '[Name of School] = 'Adamson, W.H.'".
If I then select the "Debug" key on the pop-up window, I am taken to the VBA screen, where the following is highlighted:
DoCmd.OpenForm "Campus_Input", acNormal, , SelectedNameofSchool, acFormEdit, acWindowNormal
When the cursor is over "SelectedNameofSchool" I can see that the selected school is correct, so It seems that at least the school is being selected.
Here is my code:
Option Explicit
Private Sub Command1_Click()
Dim SelectedNameofSchool As String
SelectedNameofSchool = "[Name of School] = '" & Me![School_Choice] & "'"""
DoCmd.OpenForm "Campus_Input", acNormal, , SelectedNameofSchool, acFormEdit, acWindowNormal
End Sub
The code on my "Campus_Input" form is as follows:
Option Compare Database
Private Sub Form_Open(Cancel As String)
If Not IsNull(Me.OpenArgs) Then
Dim lngID As Long
Dim rs As Object
Set rs = Me.Recordset.Clone
lngID = Val(Me.OpenArgs)
rs.FindFirst "[Name of School] = '" & lngID
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End If
End Sub
Been trying to figure this out for a week. Your help is appreciated.
Aloha,
Luis
Run-time error '3075:'
Syntax error in string in query expression '[Name of School] = 'Adamson, W.H.'".
If I then select the "Debug" key on the pop-up window, I am taken to the VBA screen, where the following is highlighted:
DoCmd.OpenForm "Campus_Input", acNormal, , SelectedNameofSchool, acFormEdit, acWindowNormal
When the cursor is over "SelectedNameofSchool" I can see that the selected school is correct, so It seems that at least the school is being selected.
Here is my code:
Option Explicit
Private Sub Command1_Click()
Dim SelectedNameofSchool As String
SelectedNameofSchool = "[Name of School] = '" & Me![School_Choice] & "'"""
DoCmd.OpenForm "Campus_Input", acNormal, , SelectedNameofSchool, acFormEdit, acWindowNormal
End Sub
The code on my "Campus_Input" form is as follows:
Option Compare Database
Private Sub Form_Open(Cancel As String)
If Not IsNull(Me.OpenArgs) Then
Dim lngID As Long
Dim rs As Object
Set rs = Me.Recordset.Clone
lngID = Val(Me.OpenArgs)
rs.FindFirst "[Name of School] = '" & lngID
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End If
End Sub
Been trying to figure this out for a week. Your help is appreciated.
Aloha,
Luis