Re: References Bug

Tech-Archive recommends: Fix windows errors by optimizing your registry



David Brown wrote in message <e0tVwTDOGHA.3888@xxxxxxxxxxxxxxxxxxxx> :

You may have hit upon something there. My feature uses the .additem/.removeitem methods as shown below. Is there anything I can do to make this work for Access 2000 users?

Thanks,

David Brown

Private Sub cboSiteID_AfterUpdate()

'populate the patient field based on site ID

Dim MyTempCount As Integer

Dim cnn1 As New ADODB.Connection

Dim cmd1 As New ADODB.Command

Dim SQLString1 As String

Dim rst1 As ADODB.Recordset

Dim MySite As Integer

Dim FirstTime As Integer

MySite = Me.cboSiteID

'Remove values from the current list

MyTempPat = Me.cboPatientName.ListCount - 1

If MyTempPat > -1 Then

For x = MyTempPat To 0 Step -1

Me.cboPatientName.RemoveItem (x)

Next

End If



'Open a connection to the current project

Set cnn1 = CurrentProject.Connection

'Create query strings

SQLString1 = "SELECT * FROM qry_ActivePatients WHERE Pat_SiteID = " & MySite

Set cmd1 = New ADODB.Command

With cmd1

.ActiveConnection = cnn1

.CommandText = SQLString1

.Execute

End With

Set rst1 = New ADODB.Recordset

rst1.Open cmd1

While Not rst1.EOF

MyName = rst1(0) & ";" & rst1(1) & ";" & rst1(2) & ";" & rst1(3)

Me.cboPatientName.AddItem Item:=MyName

rst1.MoveNext

Wend

Me.cboPatientName.Enabled = True

Me.lblTip.Visible = True

Me.lblTipContent.Visible = True

End Sub





"RoyVidar" <roy_vidarNOSPAM@xxxxxxxx> wrote in message news:mn.aa647d62aafdaa18.33955@xxxxxxxxxxx
David Brown wrote in message <O5nMzKrNGHA.3732@xxxxxxxxxxxxxxxxxxxx> :
I have a database that I've distributed to Access 2000 and Access 2002 users. There is one particular feature that will work just fine on my computer (Access 2002) but not on another computer (Access 2000). I understand that this may be a reference library issue. Upon investigation, I've found that I have the following references on my computer:

Visual Basic for Applications

Microsoft Access 10.0 Object Library

OLE Automation

Microsoft ActiveX Data Objects 2.1 Library

Microsoft Forms 2.0 Library



My end user has the following refernce libraries checked:



Visual Basic for Applications
Microsoft Access 9.0 Object Library
OLE Automation
Microsoft ActiveX Data Objects 2.1 Library
Microsoft Forms 2.0 Library

First question, I have a newer version of the Microsoft Access Object Library. Am I right in thinking that this may be the cause of my trouble? Second, what is the easiest way to fix the problem?

Thanks for your help,

David

The Microsoft Forms reference is a bit unusual, isn't it? Isn't that
what's needed to use UserForms in Word and Excel?

Well, anyway, it's perhaps easier to address the issue if we also knew
which feature isn't working - I mean - usually with reference issues,
nothing would work, or you'd get errors on left, mid, format i e the
most common VBA functions, or other strange stuff.

A couple of things of the top of my head, that exist in 2002 but not in
2000
- filedialog object
- .additem/.removeitem methods of native combos and list box controls
- windowmode and openargs arguements for the docmd.openreport method

-- Roy-Vidar



Since you're dropping all items, there's no problem, you could either
just set the .rowsource of the combo to vbNullString - or not bother
with it at all, just allow the new .rowsource to replace the old one.

To populate the combo, there's one handy ADO trick called .GetString -
but it would require a fixed column list from the recordset, not select
*.

SQLString1 = "SELECT field1, field2, field3, field4 " & _
"FROM qry_ActivePatients WHERE Pat_SiteID = " & MySite


Then after opening the recordset, you could do

Me!cboPatientName.RowSource = rst1.getstring(adclipstring,,";",";")

Note - the .RowSourceType of the combo would need to be set to Value
List, not Table/Query.

To check out how the .getstring works, and the different arguements,
take a look in the help files, it's pretty good for debuging purposes,
too.

debug.print rst.getstring
' then check the result in immediate pane (ctrl+g)

--
Roy-Vidar


.



Relevant Pages

  • Re: References Bug
    ... Dim cnn1 As New ADODB.Connection ... There is one particular feature that will work just fine on my ... Microsoft ActiveX Data Objects 2.1 Library ... My end user has the following refernce libraries checked: ...
    (microsoft.public.access.formscoding)
  • Re: How can you implement MSHTML.HTMLDocument in ASP???
    ... The problem is that I get: Microsoft VBScript runtime error ... This error is usually generated because dynamic-link libraries on ... Not in the system path ... > Dim m As MSHTML.HTMLDocument, ...
    (microsoft.public.inetserver.asp.general)
  • Re: Extra Excel Instance
    ... Microsoft ActiveX Data Objects 2.5 Library ... I used the "OutputTo" to get the query into Excel. ... Dim db As DAO.Database ... Set appex = CreateObject ...
    (microsoft.public.access.modulesdaovba)
  • Re: LDAP query information
    ... Copyright 1985-2001 Microsoft Corp. ... Dim strBase, strFilter, strAttributes, strQuery, adoRecordset ... Set adoConnection = CreateObject ... ' Construct LDAP syntax query. ...
    (microsoft.public.windows.server.scripting)
  • Re: Member or Data Member not Found
    ... Microsoft introduced a new data access method in the late 90s known as ADO. ... Access 97 and previous only had DAO in them. ... You must disambiguate as Dim rst As DAO.Recordset. ...
    (microsoft.public.access.formscoding)