Button on Form not working

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

I am trying to create a button on a ClassInput Form (junction form
tracking what staff members which courses) to take me to the
corresponding record on the EducationCourses Form. It is opening the
correct form but taking me to a blank record. I am not sure what my
aurguments should be for the GoToRecord action. This is what my macro
looks like right now

Action Arguments
OpenForm - frmEducationOfferings, Form, , [CourseTitle]=[Forms]!
[frmEducationOfferings]![CourseTitle],Edit,
Normal
GoToRecord - NOT SURE WHAT TO PUT HERE
 
I would not use the GoToRecord at all.

The command button should call the OpenForm method and pass a criteria which
filters the form for the appropriate class. It should look something like:

Private Sub cmd_EdCourse_Click

Dim strCriteria

strCriteria = "[CourseTitle] = """ & me.CourseTitle & """"
Docmd.OpenForm "frmEdCourses",acNormal,,strCriteria,,acDialog

End Sub

This should work, although I prefer to use the CourseID (since most people
rarely index text fields and indexed searches run quicker).
 
I would not use the GoToRecord at all.

The command button should call the OpenForm method and pass a criteria which
filters the form for the appropriate class.  It should look something like:

Private Sub cmd_EdCourse_Click

    Dim strCriteria

    strCriteria = "[CourseTitle] = """ & me.CourseTitle & """"
    Docmd.OpenForm "frmEdCourses",acNormal,,strCriteria,,acDialog

End Sub

This should work, although I prefer to use the CourseID (since most people
rarely index text fields and indexed searches run quicker).

----
HTH
Dale



Steve said:
I am trying to create a button on a  ClassInput Form (junction form
tracking what staff members which courses) to take me to the
corresponding record on the EducationCourses Form. It is opening the
correct form but taking me to a blank record. I am not sure what my
aurguments should be for the GoToRecord action. This is what my macro
looks like right now
Action                  Arguments
OpenForm - frmEducationOfferings, Form, , [CourseTitle]=[Forms]!
[frmEducationOfferings]![CourseTitle],Edit,
Normal
GoToRecord - NOT SURE WHAT TO PUT HERE
.- Hide quoted text -

- Show quoted text -

Thanks Dale I appreciated it. I figured out what I was doing wrong. I
had my criteria formula inverted. The left side of the equal sign is
suposed to be field and the table I am going to and the right the
information from the field I am referencing in the current form. Don't
ask me how I figured that out because I couldn't tell you. But it is
working now and that is all that maters. Thanks so much!
 
Back
Top