Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 2nd, 2007, 01:01 PM
Authorized User
Join Date: Jul 2007
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to resolve #Name? Error problem in few fields

I am calling a stored procedure from an Access unbound form.I made sure that the control source of the unbound form is named in accordance with the output of the stored procedure. However, in some of the fields instead of getting proper value I am getting #Name? in the data. I am not sure exactly why the values are not being displayed. Is it the stored procedure parameter setting incorrect or something else. Still a puzzle. Any help is appreciate. Thanks


Private Sub Form_Load()

'To make all the fields visible

'MarketChannel.Visible = True
'TBSGroup.Visible = True
'Amount.Visible = True
'GLPeriod.Visible = True
'GLYear.Visible = True

Dim cmdSelect As ADODB.Command
Dim strMarketChannel As String
Dim strTBSGroup As String
Dim strAmount As String
Dim strGLPeriod As String
Dim strGLYear As String
Dim curAmount As Currency
 Set conn = New ADODB.Connection
 Set cmdSelect = New ADODB.Command

 conn.Provider = "SQLOLEDB"

' conn.ConnectionString = "Provider=SQLOLEDB.1;Initial Catalog=pubs;Data Source=localhost;User ID=sa;Password=1CdoBn98;"
conn.ConnectionString = "Provider=SQLOLEDB.1;Initial Catalog=TBS;Data Source=USILDEK1-21001;User ID=sa;Password=test;"
 conn.CursorLocation = adUseClient

'Code added

cmdSelect.CommandType = adCmdStoredProc
cmdSelect.CommandText = "sp_select_data"
Set cmdSelect.ActiveConnection = conn

  ' Get the form values
  strMarketChannel = Forms!frmSearchRecords!cboBusinessUnit
  strTBSGroup = Forms!frmSearchRecords!cboTbsGroup
  strGLPeriod = Forms!frmSearchRecords!cboGLPeriod
  strGLYear = Forms!frmSearchRecords!cboTBSYear

  strTBSGroup1 = Val(strTBSGroup)
  strGLPeriod1 = Val(strGLPeriod)
  strGLYear1 = Val(strGLYear)

   MsgBox ("Procedure complete. Records selected" & vbCrLf & _
 "Parameter 1: " & strMarketChannel & vbCrLf & "Parameter 2: " & strTBSGroup & vbCrLf & "Parameter 3: " & strGLPeriod & vbCrLf & "Parameter 4: " & strGLYear)

   ' Add the parameters
    cmdSelect.Parameters.Append cmdSelect.CreateParameter("@businessunit", adVarWChar, adParamInput, 1, strMarketChannel)
    cmdSelect.Parameters.Append cmdSelect.CreateParameter("@tbsgroup", adInteger, adParamInput, 8, strTBSGroup1)
    cmdSelect.Parameters.Append cmdSelect.CreateParameter("@glperiod", adInteger, adParamInput, 8, strGLPeriod1)
    cmdSelect.Parameters.Append cmdSelect.CreateParameter("@tbsyear", adInteger, adParamInput, 8, strGLYear1)
    'cmdSelect.Parameters.Append cmdSelect.CreateParameter("@Percent", adCurrency, adParamInput, , curPercent1)

   ' Execute the command
 Set rs = cmdSelect.Execute

 Set Me.Recordset = rs

End Sub


CREATE procedure sp_select_data
@businessunit char(1),
@tbsgroup int,
@glperiod int,
@tbsyear int
select MktChannel, [TBS Grp], Amount, [GL Per], [GL Yr] from tblTBS
MktChannel = @businessunit and
[TBS Grp] = @tbsgroup and
[GL Per] = @glperiod and
[GL Yr] = @tbsyear
Old August 2nd, 2007, 02:08 PM
Authorized User
Join Date: Jul 2007
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts

Never mind folks. Problems solved. I was not looking carefully enough in the fields where two of those were mismatch with the output from stored procedure. Thanks anyway.

Similar Threads
Thread Thread Starter Forum Replies Last Post
soapenv:Client - Error: Could not resolve to an op crmpicco XML 7 November 12th, 2008 01:18 PM
Need help to Resolve Error ORA-00933 sandeepshivathaya Oracle 0 August 19th, 2004 07:15 AM
Error-cannot resolve symbol Rusk JSP Basics 1 February 18th, 2004 09:20 AM
cannot resolve symbol problem ioda006 JSP Basics 2 July 28th, 2003 06:04 AM
Error: Cannot resolve symbol "Beginning JSP" amcp2002 Wrox Book Feedback 2 July 22nd, 2003 03:30 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.