Great Plains Dexterity Dynamics eEnterprise Microsoft CRM Microsoft RMS Crystal Reports SQL .Net C# International Chicago Illinois Customizations Great Plains Programming Development Offshore Programming FRx ReportWriter Integration Manager POS Upgrade Data Recovery Conversion EDI Barcoding SQL Multicurrency Microsoft Business Solutions Great Plains Certified Master FAQ Forum Continuum for VB Btrieve Ctree Pervasive SQL.2000 Great Plains Business Portal eOrder eView eRequisition Intellisol Kampdata Mekorma Horizon Wennsoft Naperville Schaumburg Lombard Hinsdale Aurora Rockford Downers Grove Brazil Moscow Montreal Mexico USA Canada California
VBA or VBScript cannot:
Compile an executable EXE
Create ActiveX DLLs
Create database tools such as the Data Manager
Create OLE Automation Servers
Create ActiveX Documents
Create ActiveX Controls
Increase execution speed because VB is fully compiled
Use multiple projects
Control source code through Visual SourceSafe
Reuse VB components
Construct class files
Use Data Control and data-aware controls (such as TextBox, Grid, ListBox, and
ComboBox)
Use numerous additional controls, including disk-access controls (DirListBox,
DriveListBox, and so on) and user-interface controls (status bar, toolbar, and
so on).
Modules: Modifier with VBA
Question: What are some the issues a user should be aware of when creating a .package file to distribute a customization?
Answer: The following are issues to be aware of when importing and exporting
package files.
1.) Dynamics and eEnterprise contain forms, which are groups of windows, menus
and other resources that work together. A form can have several windows, but
you can make changes to individual windows on a form with Modifier. When you
export a .package file, you are exporting all the windows on a
form, not just the windows.
2.) If a customized version of the form already exists in Dynamics or
eEnterprise and you import another set of customizations for the same form, the
original customizations will be overwritten. This will occur even if
customizations are made to other windows on the form.
A warning message will occur allowing you to cancel the import.
3.) Customization Site Enabler or Modifier must be registered before you have the ability to import .Package files into a client installation.
4.) Some global changes you make with Modifier can't be included in a .package file. Changes to global data types are not included in a package file. To distribution the project, you will need to copy the Forms.dic and Dynamics.vba file to the client installation.
Modules: Modifier with VBA
Question: Can the default sort order on lookup window be changed? It has been attempted using the Window_AfterOpen event to set SortBy =2 but Dynamics seems to ignore this? What else needs to be done?
Answer: This works on most windows, with the exception of some lookup windows. The Dynamics code on the lookup button normally opens the lookup form and then runs code to initialize the lookup window. The problem is that the WindowAfterOpen event on the lookup window fires before the Dynamics code runs to initialize the Sort By drop down list. Therefore, the Dynamics code sets the drop down list value back to the default.
The solution is to add both the original (calling) window and the lookup window to the VBA project. On the lookup button, add an AfterUserChanged event to set the drop down 'Sort By' field to the value you would like.
In this example, we wish to default the CustomersandProspects window to Customer Name (value 2 in the lookup sort drop down). The CustomerMaintenance Window and it's customer lookup button are added. Then, the CustomerandProspects lookup window and the CustomerSortBy field are added. The only line of code necessary is on the Customer Lookup Button. Note that we must include the window name when setting the value of the field that is on the other window.
Private Sub LookupButton1_AfterUserChanged()
CustomersandProspects.CustomerSortBy = 2
End Sub
Modules: Modifier with VBA
Question: After installing Dynamics with VBA on a Citrix Server from a Citrix client machine, the VBA functions appear activated under Tools-Customize (the Visual Basic Editor, Add Current Window to Visual Basic, and Add Fields to Visual Basic list choices are not grayed out to background and are displayed in normal font mode). But, when clicking on a VBA function list choice, the pointer disappears and comes right back--it does not change to an hour glass. What could be happening?
Answer: The Citrix User that is logged in may not have the correct rights or
is missing Dynamics VBA registry entries/ initialization files. When installing
in a Citrix environment, the Citrix CHANGE USER Utility must be used to install
Dynamics with VBA. The Citrix CHANGE USER command places the Citrix WINFRAME
system in install mode and allows Citrix WINFRAME to keep track of the
user-specific application registry entries or initialization files(INI) an
application installs during installation. WINFRAME can then automatically
propagate the registry entries or INI files to each user as they are needed by
the application. Reinstall Dynamics with VBA to the server using the
instructions provided in your Citrix WINFRAME manual for the Citrix CHANGE USER
Utility.
Also review the Techknowledges titled "Unable to Launch Visual Basic Editor from
Dynamics or eEnterprise" for additional information on rights to the Registry.
Question: What is stored in the Forms.dic and the Reports.dic?
Answer: The FORMS.DIC holds all forms (Dynamics windows) that have been modified using Modifier. The REPORTS.DIC holds all Dynamics reports that have been modified using Report Writer, and all new reports created for use with Dynamics. Neither of these dictionaries is installed with Dynamics. The FORMS.DIC is created when Modifier is launched and no other FORMS.DIC exists (usually the first time you access Modifier). The REPORTS.DIC is created when Report Writer is launched and no other REPORTS.DIC exist (again, usually the first time you access Report Writer).
If you delete either of these dictionaries, you will lose all modified forms and/or reports unless you restore from a backup.
Question:
I would like to see an example of executing a SQL stored procedure
using ADO with VB scripting.
Answer:
The following is an example of a VB script that will connect to the TWO
database, login as SA, without a password. After the connection is made,
it executes a stored procedure named DIM_TEST.
Dim ADOrs
Dim ADOcon
Dim ADOcmd
Set ADOrs = CreateObject("ADODB.Recordset")
Set ADOcon = CreateObject("ADODB.Connection")
ADOcon.ConnectionString = "Provider=SQLOLEDB;DSN=Dynamics;Initial Catalog=TWO;User Id=sa;Password="
ADOcon.Open
ADOcmd = "{call DIM_TEST}"
Set ADOrs = ADOcon.Execute(ADOcmd)
ADOcon.Close
Question:
How can the default options be over ridding when a window is open? In some
cases, the users would like some checkboxes unmarked, or another option selected
in a drop or a string value in a field.
Answer:
VBA can used to change the default values of many fields after the window has
opened. The examples listed below is the After Open event, allowing the
necessary Dynamics code to run before changing the values. It also prevents
Dynamics/eEnterprise from overriding the values that are trying to be set with
VBA.
Checkboxes
To unmark a checkbox, the field should be set
equal to zero. The following example uses the Payables Transaction
Inquiry-Vendor window. There are three checkboxes for Work, Open and History.
This example will uncheck the History option.
Private Sub Window_AfterOpen()
Include = 0
End Sub
Include is the name of the button in VBA. The
field is added according to the name of the group of checkboxes it is in. In
this window, the group of buttons is called 'Include'. The first field added to
VBA is titled Include, the second window added to VBA is called Include1 and the
final button Include2.
Radio Buttons
Radio buttons work in a similar fashion
to the Checkboxes. To have the first item in a radio button be the default
value, the field should be set equal to zero. If the second item should be the
default value, the field should be set equal to one. The following example uses
the Payables Transaction Inquiry-Vendor window. Instead of selecting 'All',
VBA will be used to select 'FROM' so that a range can be selected.
Private Sub Window_AfterOpen()
Documents1 = 1
End Sub
Again, the radio buttons are added according to the name of a radio button group they belong to. In this case they are being added as Documents1.
Drop Down Lists
To select a different value in a drop
down list, the field will be set equal to a number of the order that it is in
the drop down list. If the value that is desired to be defaulted is third in
the list, the field will be set equal to three.
The following example will use the Payables Transaction Inquiry-Vendor window again. This time, the default value for sorting Documents will change. Instead of using the Dynamics default of 'by Document Number' the default will be changed to 'by Type'. By Type is the third item in the drop, so the value of the field is being set equal to three.
Private Sub Window_AfterOpen()
Documents = 3
End Sub
String Fields
To set a value for a string field, it
is just a matter of setting the field equal to the value you want to default.
The following example uses the Payables Transaction Inquiry-Vendor window. The
Vendor ID field is being populated with the Vendor ID of ACETRAVE0001.
Private Sub Window_AfterOpen()
VendorID = "ACETRAVE0001"
End Sub
Question: When printing a Crystal report using the Crystal.OCX control, it prints fine, but after it closes Btrieve errors occur in Dynamics, similar to as if I've lost connection to the database. What has happened?
Answer: The Btrieve connection was lost. Closing the print engine kills the Btrieve connections. To resolve this, change Dynamics so that it does not put a client ID on it transactions by adding the following line to your DEX.INI file:
IgnoreTransactions=TRUE
This problem would happen calling the OCX, ActiveX DLL, or the Crystal C++
DLL from VBA. This only occurs in Dexterity version below 5.50 as
that parameter is now the default.
Modules: Modifier with VBA
Question: Dynamics will not link to VBA Editor, will not
copy Dynamics windows or fields to the VBA Dynamics project or will not run
existing VBA code. What could be causing these problems? ( I received no error
messages during the Dynamics installation.)
Answer: For the workstation on which you are trying to use VBA, you should be
logged in as a user who is a member of the Administrators and/or Power Users
local group. It may be possible to edit the registry on the workstation to allow
other users to access VBA, but the recommended solution would be to include the
user in at least one of these 2 local groups. Following are the suggested
modifications to allow others users access to VBA:
Modifying the Registry
WARNING: Using Registry Editor incorrectly can cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk.
For information about how to edit the registry, view the "Changing Keys and Values" Help topic in Registry Editor (Regedit.exe) or the "Add and Delete Information in the Registry" and "Edit Registry Data" Help topics in Regedt32.exe. Note that you should back up the registry before you edit it. You should also update your Emergency Repair Disk (ERD).
Registry Keys to Modify
HKEY_CLASSES_ROOT\Clsid
HKEY_CLASSES_ROOT\Typelib
HKEY_CLASSES_ROOT\Interface
HKEY_LOCAL_MACHINE\Software\Classes\CLSID
Steps to Grant Permissions to Registry Keys
1. Log in as Administrator.
2. On the Windows Start menu, click Run. Type regedt32.exe, and then click OK
to start the Registry Editor.
3. Locate the key HKEY_CLASSES_ROOT\Clsid.
4. On the Security menu, click Permissions. The Registry Key Permissions dialog
box appears.
5. Click on Add, add the users or groups, and then select Full Control for the
type of access. 6. Click OK to close the dialog box.
7. Repeat steps 3 through 6 for the remaining registry keys.
8. Quit the registry editor.
Modules: Modifier with VBA
Question: Can VBA be used to start a macro?
Answer: To run a Dynamics macro from VBA, add the macro to a Dynamics palette that you will not use very frequently. Then add the Palette window and field to your VBA project. The code you would use would look similar to the following:
PaletteWindow.Open
PaletteWindow.Hide
PaletteWindow.PaletteButton = 1
PaletteWindow.Close
Modules: Modifier with VBA
Question: When launching Dynamics, an error message regarding ".. VBA project reference some objects that cannot be found...." is displayed. It indicates to look in a Dynamics.TXT file for a list of the invalid references. How can these bad references?
Answer: The fields that are listed in the Dynamics.TXT file are invalid references that exist within the VBA project. This means that the Dynamics runtime engine cannot match up the field in the VBA project with its appropriate field in the Dynamics.DIC or Forms.DIC. In the VBA project, they appear with a "dfield" designation in the Properties sheet.
To resolve the deleted field references in your Dynamics.VBA project file, you will need to do the following.
1 - Open the VBA project file and open the code for the object (window, grid
or report) that has the bad reference.
2 - Write down the list of fields that need to be added to this object.
3 - Copy the source code from this object to a text file and save it.
4 - Open this particular object in Dynamics and select "Remove Current Window
from Visual Basic" or "Remove Current Report from Visual Basic" from the Tools
menu.
5 - Add the object back to the project using "Add Current Window to Visual
Basic" or "Add Current Report to Visual Basic".
6 - Add the fields back to the object from your list in Step 2.
7 - Paste the code back into this object from Step 3.
8 - Compile and Save the VBA code for this object.
9 - Test the code to make sure that it still works properly.
Modules: Modifier with VBA
Question:
I added a field to the main window of a form. Using the window, I can enter and save a value in the new field. However, when I redisplay the data in the window, the old value appears in the field instead of the value I entered.
Answer:
The field you added is already located on another window within the same
form. The value in the field you added will be overwritten by data in the field
that already existed on the other window. The field you added can be used to
display data, but not to enter data.
Product: Customization and Integration Tools
Versions: 5.5, 6.0
Modules: Modifier with VBA
Question: Modifier was used to add a button to another vendor's third-party window (ApplicationA dictionary). When the button is pushed, it should open a (ApplicationB dictionary) Dexterity application. When the button is pushed, the error message 424 (Form Not Found or Object Required) is returned. The following statement is being used in the project for the third-party window (ApplicationA): ApplicationB.WindowName.Open
The error message is returned no matter what event procedure is selected for the button object in VBA. How can this be resolved?
Answer:
To resolve this error message, a Reference must be added to the third-party application (ApplicationB) in the project for ApplicationA.
1 - Go to VBA Editor and click on the Tools command from the VBA Editor
Command Bar.
2 - Select the References option of the Tools command.
3 - Click on the checkbox for your third-party application (ApplicationB) to
which you are interfacing .
There is one situation to avoid:
In your project (ApplicationA), a reference to another project (ApplicationB)
can be added. However, once it has been added, another reference can not
be made from ApplicationB back to ApplicationA. Basically, the reference is only
valid in one direction.
For example, assume the following references have been made in your VBA
projects:
Dynamics references ApplicationA
ApplicationA references ApplicationB
ApplicationB references ApplicationC
If this references are made, then the following references would be invalid:
ApplicationA to Dynamics, ApplicationB to ApplicationA and ApplicationC to
ApplicationB.