Button on Form not working

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
 
D

Dale Fye

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).
 
S

Steve

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top