Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Multiuser / Networking / July 2005

Tip: Looking for answers? Try searching our database.

VBA code not working

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bari S - 26 Jul 2005 15:53 GMT
Hello,

Very new to using VBA Code. Here is the problem:

I developed a database and application using Access 2002 SP3. It utilizes
quite a few VBA modules, procedures etc.

My client is using Access 2002 SP2 on a network. The database is stored on a
shared drive on their network.

Although the database opens and all non VBA parts work, none of the code
works on site - but works for fine for me. Both of us are running Office XP
Pro.

What could be some possible reasons and fixes to this?

Thanks in advance
Joan Wild - 26 Jul 2005 17:10 GMT
> I developed a database and application using Access 2002 SP3. It utilizes
> quite a few VBA modules, procedures etc.
[quoted text clipped - 7 lines]
> XP
> Pro.

'none of the code works' - what does this mean?  Do you get error messages?

Is there some reason the client hasn't installed sp3?

Signature

Joan Wild
Microsoft Access MVP

Bari S - 26 Jul 2005 17:59 GMT
Hi

1.Well - "none of the code works" ... means that chunks of code such as the
one below will bo nothing! No messages or anything!

However other things such as an event procedure for a form open event will
work ... it contains simple Docmd statements.

2. I will suggest to their sysadmin to install SP3.

3. Right now both the front end and the backend table files (_be) reside in
the network directory. I'm not sure if this is the cause but I will try
moving the front end to each user's machine and leaving the data file on the
network.

Curiously though, on my end (single user) everything runs fine.

Code Sample that Does not work:

Private Sub cmdSaveEthSel_Click()

On Error GoTo Err_cmdSaveEthSel_Click

   If IsNull(Forms!frm_CreateResource!OrgID) Then
       Interaction.MsgBox "You must have an Organization selected to add
Ethnicities", vbInformation, ""
       Exit Sub
   Else
     If Forms!frm_CreateResource!EthList.ItemsSelected.Count = 0 Then
         Interaction.MsgBox "Please choose an Ethnicity and try again.",
vbInformation, ""
        Exit Sub
     End If
   End If
       
   Dim frm As Form, ctl As Control
   Dim varItm As Variant
   Dim intI As Integer
   Dim strSQL As String
   Dim MyDB As Database
   
   Set MyDB = CurrentDb
   Set frm = Forms!frm_CreateResource
   Set ctl = frm!EthList

   For Each varItm In ctl.ItemsSelected

           strSQL = "INSERT INTO tbl_EthnicitiesServed (EthServedOrgID,
EthID) "
           strSQL = strSQL & "VALUES(" & frm!OrgID & "," & ctl.ItemData
(varItm) & ")" & ";"
           
           Debug.Print strSQL
           
           MyDB.Execute strSQL
           
           ctl.Selected(varItm) = False

   Next varItm

EthServedList.Requery

Set MyDB = Nothing
Set frm = Nothing
Set ctl = Nothing

Exit_cmdSaveEthSel_Click:
   Exit Sub
   
Err_cmdSaveEthSel_Click:
   MsgBox Err.Description
   Resume Exit_cmdSaveEthSel_Click
     
End Sub

>> I developed a database and application using Access 2002 SP3. It utilizes
>> quite a few VBA modules, procedures etc.
[quoted text clipped - 5 lines]
>
>Is there some reason the client hasn't installed sp3?
Joan Wild - 27 Jul 2005 15:26 GMT
> Hi
>
> 1.Well - "none of the code works" ... means that chunks of code such as
> the
> one below will bo nothing! No messages or anything!

You could put a breakpoint in and step through the code to see what's
happening.

> Code Sample that Does not work:
>
[quoted text clipped - 5 lines]
>        Interaction.MsgBox "You must have an Organization selected to add
> Ethnicities", vbInformation, ""

This just needs to be
MsgBox "You must.....
Interaction is for  use in the Object Browser.

>    For Each varItm In ctl.ItemsSelected
>
[quoted text clipped - 4 lines]
>
>            Debug.Print strSQL
Is the statement correct in the immediate window?  Is the item added to
tbl_EthnicitiesServed?
Put a breakpoint at 'For each varItm...' above and step through the code.

Signature

Joan Wild
Microsoft Access MVP

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.