Solved

Build Problems

Posted on 2002-06-14
9
132 Views
Last Modified: 2010-05-02
I have my app talking with SQL Server....

It works perfectly when I run it in build mode but then when I create the exe it hangs in various places such as after doing a recordset .update, it is supposed to display a message box.  In the build "run" it works, but in the .exe build it hangs where it should be displaying the message.

Any ideas?
0
Comment
Question by:baddogi
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 1

Expert Comment

by:toys032498
ID: 7078662
Try putting a DoEvents prior to the message box.

0
 

Author Comment

by:baddogi
ID: 7078669
I've narrowed it down to the following code that is causing this:

'Msg = "Are You Sure You Want To Add This Department?"
'Style = vbYesNo + vbDefaultButton2
'title = "Confirmation"
'response = MsgBox(Msg, Style, title)


If I unrem this it hangs.....

Ideas?
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 7078798
What code runs just before this?

mlmcc
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:baddogi
ID: 7078822
Here is the actual sub...

Sub Save_Click()

On Error GoTo errmsg:

Msg = "Are You Sure You Want To Add This Department?"
Style = vbYesNo + vbDefaultButton2
title = "Confirmation"
response = MsgBox(Msg, Style, title)
    If response = vbYes Then

    If txtdepartment.Text = "" Then
        MsgBox "Please Enter a Department Name"
    Exit Sub
    End If


With RS

.AddNew

!department = txtdepartment.Text


.Update

End With

MsgBox "Add Succeeded", vbOKOnly, "Status"
lblnew.Visible = False
txtdepartment.Visible = False

lblselect.Visible = True
combodepartment.Visible = True

ElseIf response = vbNo Then
lblnew.Visible = False
txtdepartment.Visible = False

lblselect.Visible = True
combodepartment.Visible = True
RS.Filter = adFilterNone
txtdepartment.Text = ""

Exit Sub
End If

Exit Sub

errmsg:

     MsgBox "Error # " & Str(Err.Number) & Chr(13) & Err.Description
         
Exit Sub
End Sub
0
 

Author Comment

by:baddogi
ID: 7078895
Here is the actual sub...

Sub Save_Click()

On Error GoTo errmsg:

Msg = "Are You Sure You Want To Add This Department?"
Style = vbYesNo + vbDefaultButton2
title = "Confirmation"
response = MsgBox(Msg, Style, title)
    If response = vbYes Then

    If txtdepartment.Text = "" Then
        MsgBox "Please Enter a Department Name"
    Exit Sub
    End If


With RS

.AddNew

!department = txtdepartment.Text


.Update

End With

MsgBox "Add Succeeded", vbOKOnly, "Status"
lblnew.Visible = False
txtdepartment.Visible = False

lblselect.Visible = True
combodepartment.Visible = True

ElseIf response = vbNo Then
lblnew.Visible = False
txtdepartment.Visible = False

lblselect.Visible = True
combodepartment.Visible = True
RS.Filter = adFilterNone
txtdepartment.Text = ""

Exit Sub
End If

Exit Sub

errmsg:

     MsgBox "Error # " & Str(Err.Number) & Chr(13) & Err.Description
         
Exit Sub
End Sub
0
 
LVL 4

Expert Comment

by:gencross
ID: 7079169
I think maybe your variable names are causing this.  I do not see any DIMs and Style is a keywork.  Try something like this...

Sub Save_Click()

Dim sMsg as string
Dim vStyle
Dim sTitle as string
Dim iResponse as integer

On Error GoTo errmsg:

sMsg = "Are You Sure You Want To Add This Department?"
vStyle = vbYesNo + vbDefaultButton2
sTitle = "Confirmation"
iResponse = MsgBox(sMsg, vStyle, sTitle)
0
 
LVL 4

Accepted Solution

by:
gencross earned 200 total points
ID: 7079174
I mean Style is a VB Keyword.  Whether or not this is the solution to your problem it is always good programming practice to prefix your variable names.  There are different naming conventions you can use :)
0
 
LVL 1

Expert Comment

by:toys032498
ID: 7079753
Nice job gencross!  I totally over looked that.

Thats why you should always use the following in the begining of every module.

Option Explict
0
 
LVL 4

Expert Comment

by:gencross
ID: 7083486
Thanks.  This one is easy to miss, and Option Explicit is the way to go:)

0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question