473,386 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Error 3085 Undefined function 'lstPrintCheckedStaff.Column'' in expression

Hi all,

Hoping someone might be able to point me in the right direction with getting the code below to work properly.
Effectively, the code:
  • Requerys the listbox in lstPrintCheckedStaff
  • Selects all the items rows in lstPrintCheckedStaff
Then for each row in the list box:
  • Calls a msgbox to confirm if an e-mail should be sent to that person. (Yes / No)
  • If yes, sends an e-mail and records that in the table AuditLog
The problem I have is with the very last bit - recording to the Audit Log and specifically the Name (obtained from lstPrintCheckedStaff.Column(1) and lstPrintCheckedStaff.Column(3). When running the code it works fine (and sends the e-mail), but presents me with error 3085 "Undefined function 'lstPrintCheckedStaff.Column' in expression" every time. I've tried loads of different ways I can think of (including "Dim"ing it first, but it jsut requests the parameter value then...

Any suggestions/assistance greatly apprecicated!
Cheers,
Will

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdIssueEmailNotifications_Click()
  2. On Error GoTo ErrorHandler
  3.  
  4.     Forms!frmEditPrePayment!lstPrintCheckedStaff.Requery
  5.     Call ListBoxSelectAll(Forms!frmEditPrePayment!lstPrintCheckedStaff)
  6.  
  7.     Dim varItemCheckedStaff As Variant
  8.     Dim varItemCheckedStaffName As Variant
  9.     Dim varItemCheckedStaffUsername As Variant
  10.  
  11.     For Each varItemCheckedStaff In Me.lstPrintCheckedStaff.ItemsSelected
  12.         varItemCheckedStaffName = Me.lstPrintCheckedStaff.Column(1, varItemCheckedStaff) & " " & Me.lstPrintCheckedStaff.Column(2, varItemCheckedStaff)
  13.  
  14.         Dim mbxResponse As VbMsgBoxResult
  15.         mbxResponse = MsgBox( _
  16.         "Do you want to send an e-mail to " & varItemCheckedStaffName & "?", _
  17.         vbQuestion + vbYesNo, TSM_APPLICATION_STANDARDCAPTION & "Send an e-mail...")
  18.  
  19.         If mbxResponse = vbYes Then
  20.  
  21.             Dim oApp As Object, oAcct As Object
  22.             Dim oMessages As Object, oMessage As Object
  23.             Dim ToYou As String, TheSubject As String
  24.  
  25.             varItemCheckedStaffUsername = Me.lstPrintCheckedStaff.Column(4, varItemCheckedStaff)
  26.  
  27.             ToYou = varItemCheckedStaffUsername    'Issue mailbox
  28.             TheSubject = "A QMS Feedback Sheet has been sent to your DIP tray"
  29.  
  30.             Set oApp = CreateObject("NovellGroupWareSession")
  31.             Set oAcct = oApp.login("", "")
  32.             Set oMessages = oAcct.mailbox.messages
  33.             Set oMessage = oMessages.Add()
  34.             oMessage.Priority = 2
  35.             oMessage.Recipients.Add ToYou
  36.             oMessage.Subject = TheSubject
  37.             oMessage.Send
  38.  
  39.             Dim strAuditLogUser As String
  40.                 strAuditLogUser = txtUserID.Value
  41.             Dim strAuditLogComputer As String
  42.                 strAuditLogComputer = txtComputerID.Value
  43.             Dim strEntryID As String
  44.                 strEntryID = txtEntryID.Value
  45.             Dim strAuditLogForm As String
  46.                 strAuditLogForm = Form.Name
  47.             Dim strAuditLogVBA As String
  48.                 strAuditLogVBA = "cmdIssueEmailNotifications_Click"
  49.             Dim strAuditLogAction As String
  50.                 strAuditLogAction = "Issued e-mail notification to " & lstPrintCheckedStaff.Column(1, varItemCheckedStaff) & " " & lstPrintCheckedStaff.Column(2, varItemCheckedStaff)
  51.  
  52.             DoCmd.SetWarnings (False)
  53.             Rem CurrentDb.Execute ("INSERT INTO AuditLog ([EntryID], [AuditLogUser], [AuditLogComputer], [AuditLogForm], [AuditLogVBA], [AuditLogAction])VALUES (strEntryID, strAuditLogUser, strAuditLogComputer, strAuditLogForm, strAuditLogVBA, strAuditLogAction)")
  54.             DoCmd.RunSQL ("INSERT INTO AuditLog ([EntryID], [AuditLogUser], [AuditLogComputer], [AuditLogForm], [AuditLogVBA], [AuditLogAction]) VALUES (txtEntryID.Value, txtUserID.Value, txtComputerID.Value, Form.Name, 'cmdClose_Click', 'Issued e-mail notification to ' & lstPrintCheckedStaff.Column(1, varItemCheckedStaff) & ' ' & lstPrintCheckedStaff.Column(2, varItemCheckedStaff))")
  55.             DoCmd.SetWarnings (True)
  56.  
  57.         End If
  58.  
  59.     Next
  60.  
  61. Exit_cmdIssueEmailNotifications_Click:
  62.     DoCmd.SetWarnings (True)
  63.     Exit Sub
  64.  
  65. ErrorHandler:
  66.     Beep
  67.     Call MsgBox("An error was encountered.  Please try again." & vbCrLf & _
  68.     vbCrLf & _
  69.     "If the problem persists, please contact " & TSM_APPLICATION_SYSTEMADMIN & " quoting:" & vbCrLf & _
  70.     "       Error code:     " & Err.Number & vbCrLf & _
  71.     "       Description:    " & Err.Description, vbCritical, TSM_APPLICATION_ERRORCAPTION)
  72.     Resume Exit_cmdIssueEmailNotifications_Click
  73. End Sub
Sep 8 '10 #1

✓ answered by MikeTheBike

Hi

Yes I know the problem (I think!), and I thought I had suggested an answer, but if you insist on using your current code, then try repacing this
Expand|Select|Wrap|Line Numbers
  1. DoCmd.RunSQL ("INSERT INTO AuditLog ([EntryID], [AuditLogUser], [AuditLogComputer], [AuditLogForm], [AuditLogVBA], [AuditLogAction]) VALUES (txtEntryID.Value, txtUserID.Value, txtComputerID.Value, Form.Name, 'cmdClose_Click', 'Issued e-mail notification to ' & lstPrintCheckedStaff.Column(1, varItemCheckedStaff) & ' ' & lstPrintCheckedStaff.Column(2, varItemCheckedStaff))")
with this
Expand|Select|Wrap|Line Numbers
  1. DoCmd.RunSQL "INSERT INTO AuditLog ([EntryID], [AuditLogUser], [AuditLogComputer], [AuditLogForm], [AuditLogVBA], [AuditLogAction]) VALUES (txtEntryID.Value, txtUserID.Value, txtComputerID.Value, Form.Name, 'cmdClose_Click', 'Issued e-mail notification to " & lstPrintCheckedStaff.Column(1, varItemCheckedStaff) & " " & lstPrintCheckedStaff.Column(2, varItemCheckedStaff) & "')"
I is a bit difficult to 100% sure the syntax is correct without having the code in the correct environment to compile, but I think it is OK!?

MTB

4 2046
MikeTheBike
639 Expert 512MB
Hi

I'm just gesing here but I think perhaps you should go back to you first(?) thoughts but change this
Expand|Select|Wrap|Line Numbers
  1. strAuditLogAction = "Issued e-mail notification to " & lstPrintCheckedStaff.Column(1, varItemCheckedStaff) & " " & lstPrintCheckedStaff.Column(2, varItemCheckedStaff) 
  2.  
to this
Expand|Select|Wrap|Line Numbers
  1. strAuditLogAction = "'Issued e-mail notification to " & lstPrintCheckedStaff.Column(1, varItemCheckedStaff) & " " & lstPrintCheckedStaff.Column(2, varItemCheckedStaff) & "'"
ie. put apostrophes in the string ??

In you current code you are confusing the us of these ' with these " and hence confusing the compiler!


MTB
Sep 8 '10 #2
Hi Mike,

Thanks for replying... really appreciate it.
Unfortunately, that doesn't resolve it. I've run through the code using Debug > Step Into and the error occours on this line of code:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.RunSQL ("INSERT INTO AuditLog ([EntryID], [AuditLogUser], [AuditLogComputer], [AuditLogForm], [AuditLogVBA], [AuditLogAction]) VALUES (txtEntryID.Value, txtUserID.Value, txtComputerID.Value, Form.Name, 'cmdClose_Click', 'Issued e-mail notification to ' & lstPrintCheckedStaff.Column(1, varItemCheckedStaff) & ' ' & lstPrintCheckedStaff.Column(2, varItemCheckedStaff))")
If I take out:
Expand|Select|Wrap|Line Numbers
  1. & lstPrintCheckedStaff.Column(1, varItemCheckedStaff) & ' ' & lstPrintCheckedStaff.Column(2, varItemCheckedStaff)
it runs fine. I can't see any " or ' errors and it still doesn't work if I take out all of the text from the last parameter and just leave
Expand|Select|Wrap|Line Numbers
  1. lstPrintCheckedStaff.Column(1, varItemCheckedStaff) & lstPrintCheckedStaff.Column(2, varItemCheckedStaff)
Really stumped! Any further thoughts are greatly appreciated!
Thanks again for taking to time to post.
Will
Sep 8 '10 #3
MikeTheBike
639 Expert 512MB
Hi

Yes I know the problem (I think!), and I thought I had suggested an answer, but if you insist on using your current code, then try repacing this
Expand|Select|Wrap|Line Numbers
  1. DoCmd.RunSQL ("INSERT INTO AuditLog ([EntryID], [AuditLogUser], [AuditLogComputer], [AuditLogForm], [AuditLogVBA], [AuditLogAction]) VALUES (txtEntryID.Value, txtUserID.Value, txtComputerID.Value, Form.Name, 'cmdClose_Click', 'Issued e-mail notification to ' & lstPrintCheckedStaff.Column(1, varItemCheckedStaff) & ' ' & lstPrintCheckedStaff.Column(2, varItemCheckedStaff))")
with this
Expand|Select|Wrap|Line Numbers
  1. DoCmd.RunSQL "INSERT INTO AuditLog ([EntryID], [AuditLogUser], [AuditLogComputer], [AuditLogForm], [AuditLogVBA], [AuditLogAction]) VALUES (txtEntryID.Value, txtUserID.Value, txtComputerID.Value, Form.Name, 'cmdClose_Click', 'Issued e-mail notification to " & lstPrintCheckedStaff.Column(1, varItemCheckedStaff) & " " & lstPrintCheckedStaff.Column(2, varItemCheckedStaff) & "')"
I is a bit difficult to 100% sure the syntax is correct without having the code in the correct environment to compile, but I think it is OK!?

MTB
Sep 8 '10 #4
Yeah!!!
It worked!

Thank you ever so much... really appreciate it!
Cheers,
Will
Sep 8 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Ronald W. Roberts | last post by:
I'm not sure where this routine came from, but here is the problem. On certian computers this error occurs, but it does not on others. The error is: "Undefined Function "DIR" in expression". ...
2
by: paddy_nyr | last post by:
I converted an Access 97 db to Access 2002 db and I now get the following error message when I try and run a query. Thanks Here's my query. SELECT DISTINCTROW tblCo_Info.Co_id, & Chr(13) &...
3
by: carrionk | last post by:
Hi, I'm running an ADO Recorset from Excel to gather data from Access. Basically it's copying the records of a query -that runs without problem in Access- That query has an expression with NZ()...
9
by: sam.s.kong | last post by:
Hello! I have a very basic question. a.c: <code> #include <stdio.h> main()
7
by: alanwo | last post by:
Hi Experts, Connected to Access MDB file using ADO.net OLEDB, I have a SQL to get file extension from file name which is stored as field. SELECT Right(FileName, Len(FileName) -...
8
by: Wade | last post by:
My query contains a field called TotalIn, which returns number data from an underlying table. I have modified a function, PrevRecVal, which returns the datum form the previous record in the TotalIn...
3
by: MLH | last post by:
I got this error twice in 72-hours. Each time, a different global procedure was not found. One was being used in an SQL statement and the other in a Set stmt in DAO routine. Both FNs, of...
3
patjones
by: patjones | last post by:
Good morning all: In what seems like an ongoing saga to make the DSum function do what I need it to, I am now having trouble with a user-defined function in my VBA module. Here's the offending...
2
by: CCHDGeek | last post by:
I created a database with a separate front-end that is installed on each computer and linked to a back-end server. After installing the file on several computers, I realized I was getting this...
0
by: Sebastian | last post by:
Hello I develop my applications in Access 2002. My development system is running Windows XP SP2 and I have Microsoft Office XP Developer. Microsoft Office XP is at SP3. I used Inno Setup (great...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.