Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling subprocedures w/ more than 1 argument

Status
Not open for further replies.

Jackie

MIS
Feb 9, 2000
148
US
I use the folllowing code to pass a control name to the AddRecords sub procedure.

I get the following error message: "Object Doesn't Support this Property or Method"
on the AddRecords Application, Forms![Enter Key Words]!
lst_applications.

What is causing this error message?

Sub cmd_enter_key_words_Click()

If txtAppSelected <> &quot;&quot; Then
AddRecords Application, Forms![Enter Key Words]!
lst_applications
MsgBox (&quot;Records Added&quot;)
End If

End Sub

Sub AddRecords(category_temp As String, ctlSource As Control)

Dim keyword_temp As String
Dim intCurrentRow As Integer

For intCurrentRow = 0 To ctlSource.ListCount - 1
If ctlSource.Selected(intCurrentRow) Then
keyword_temp = ctlSource.Column(0,
intCurrentRow)
DoCmd.RunSQL &quot;(INSERT INTO KeyWords
(spcr_number, category, keyword) VALUES
(Forms![Enter Key Words]!
lst_spcr_number], '&quot; & category_temp
& &quot;', '&quot; & keyword_temp & &quot;'))&quot;
End If

Next intCurrentRow

End Sub


thank you for your response.
 
Sub cmd_enter_key_words_Click()

If txtAppSelected <> &quot;&quot; Then
AddRecords &quot;Application&quot;, Forms![Enter Key Words]!
lst_applications
MsgBox (&quot;Records Added&quot;)
End If

End Sub
 
Thanks, Bob.

The syntax seems to always trip me up.
 
It has happened to me many times. It always helps to have someone else look at your code. Things that you don't catch, other people might.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top