Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Troublesome Record

Status
Not open for further replies.

cRODEEkrank

Technical User
Dec 5, 2001
41
US
I have quite a strange Access problem. I have a database which has a user form which accepts information on creating a contract with a particular contractor. The form seems to be working except when one particular contractor is selected from the drop-down menu. Typically the user selects a contractor, clicks a button and the data is mail merged into a Word document. However, when one particular contractor is selected, the button won't work. The database just hangs and does nothing.

Can anyone give me insight as to what the problem could be??? Thanks!

Crod
 
What code is run when the user clicks on the button.

When it does nothing is the hourglass showing. Can you use the keyboard or is it locked.
 
Nothing happens...no hourglass. The only thing I can do is Ctrl+alt+delete out of the database.

Here's the code when the command button is clicked:
DoCmd.DoMenuItem acFormBar, acRecordsMenu,
acSaveRecord, , acMenuVer70

If Me.CurrentRecord = 1 And blnAllNull = True Then
MsgBox prompt:="Could not create 'Contract.rtf'
because you have not entered any records.", _
buttons:=vbOKOnly + vbExclamation, _
TITLE:="NOTHING TO CREATE"
DoCmd.GoToControl "cboContractorName"
Else
' Creates an RTF file of the merge fields
DoCmd.OutputTo acForm, "frmEditorEnterNewContracts", "RichTextFormat(*.rtf)", "C:\Contract\Contract.rtf", False, ""
MsgBox "A file called ""Contract.rtf"" has been
successfully created.", vbInformation, "Mission
Accomplished"
End If

This is a strange error because it works with any other contractor except one in particular.
 
The error must be data dependent since it only happens on the one record so far. Put in some debugs so you know the path it is taking and then concentrate on that path by looking at the data and variables.

Debug.Print "some values = " etc..
If Me.CurrentRecord = 1 And blnAllNull = True Then
debug.print "currrec 1 and null "
exit sub
MsgBox prompt:="Could not create 'Contract.rtf'
because you have not entered any records.", _
buttons:=vbOKOnly + vbExclamation, _
TITLE:="NOTHING TO CREATE"
DoCmd.GoToControl "cboContractorName"
Else
' Creates an RTF file of the merge fields
debug.print "took else path "
DoCmd.OutputTo acForm, "frmEditorEnterNewContracts", "RichTextFormat(*.rtf)", "C:\Contract\Contract.rtf", False, ""
MsgBox "A file called ""Contract.rtf"" has been
successfully created.", vbInformation, "Mission
Accomplished"
End If

Do a Control G to look at the debug messages in the immediate window.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top