Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Build Problems

Posted on 2002-06-14
9
Medium Priority
?
139 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 101

Expert Comment

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

mlmcc
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 800 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

730 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