Solved

Build Problems

Posted on 2002-06-14
9
130 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
Comment Utility
Try putting a DoEvents prior to the message box.

0
 

Author Comment

by:baddogi
Comment Utility
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
Comment Utility
What code runs just before this?

mlmcc
0
 

Author Comment

by:baddogi
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

by:baddogi
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks.  This one is easy to miss, and Option Explicit is the way to go:)

0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now