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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have a form called "Report List".

Status
Not open for further replies.

bgibsonIYD

Technical User
Jun 18, 2001
28
US
I have a form called "Report List". The form has 3 tabs, and on each tab is an unbound list box. I have filled the list boxes RowSource with the following code:

SELECT Right([name],Len([Name])-3) AS NameWithoutList, [msysobjects].[Name] FROM msysobjects WHERE ((([msysobjects].[Type])=-32764) And ((Left([name],3))="pre")) ORDER BY [msysobjects].[Name];

(the 3 letters pertain to each list boxes criteria)

I have also set a Double Click event on each list box with the following code:

Private Sub List6_DblClick(Cancel As Integer)

Dim rptName As String

rptName = Me.PreReg.[Column](1)
DoCmd.OpenReport rptName, acViewPreview

End Sub

Now, I have another database that is quite similar (for a previous year) and this code works. The only thing's that changed were the titles of the tabs and the reports. I am now getting the an error message when I double click on one of the reports in the box:

run-time error '450': Wrong number of arguments or invalid property assignment.

Can anyone help with this? Why am I receiving an error message and how can I fix it?

Beth
**Learning Access**
 
What line does the debugger go to when you press debug? Is there any other code involved? Does your listbox fill with the correct report names? Do you know that listboxes/combo boxes are 0 based, meaning that column 1 is column(0)? I don't know if any of this will help, but hopefully so! Joe Miller
joe.miller@flotech.net
 
Beth,

I don't know if this is the problem or not, but try putting quotes around your rptName assignment

Code:
rptName = "Me.PreReg.[Column](1)"

HTH
 
The debugger goes to the line:


rptName = Me.PreReg.[Column](1)

There is no other code involved, just the double click even for each list box.

Yes the list box fills with the correct report names.

Yes I know that they are 0 based, and that column one is really column 0, which is the column that it should be.

I also tried putting quotes, and parenthases, and different combinations of the two and it still doesnt work.

**confused** Beth
**Learning Access**
 
Try this:

rptName = Me!PreReg.Column(1)

One thing you can do to verify the correct data is being returned is with the form open and the id selected in the combo box, go to the debug window and see what the code is returning. So open the form, select the id, press CTRL-G and in the immediate window type this:

?Forms!MyFormName!PreReg.Column(1)

Press enter and the value will show beneath the ?line. You need to type the reference to the form in the debug window, so that's why Forms!MyFormName is there.

HTH
Joe Miller
joe.miller@flotech.net
 
Hi Beth!

Just a quick question, what is PreReg? According to the first line of the procedure the control is named List6. Maybe this is just a typo, but I thought that maybe you did a cut and paste and forgot to change the name?

hth
Jeff Bridgham
 
Go to Tools | AutoCorrect. In the list box you should see an entry of ... in both the Replace: and With:. Select that entry, and delete it, and you should be OK.
 
Jeff got it! :) I knew it was going to be something as simple as that also! Ugh! Thank you Jeff! Now I feel dumb, but that's okay. We learn from that sort of thing right?! :)

Thanx for your help everyone!

Beth Beth
**Learning Access**
 
Good read Jebry, I totally missed that one as well... Joe Miller
joe.miller@flotech.net
 
Hi Beth!

You're Welcome. And please don't feel dumb! Believe me, I am very familiar with learning from mistakes of that sort! :)

Jeff Bridgham
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top