Error #40036 now causing problems.

CraigWarmy

Registered User.
Local time
Today, 01:17
Joined
Feb 13, 2009
Messages
30
This code is the latest to come up and causing problems with error #40036.
Been there for a long time and then it quit working for me. Error Code:

nRoomID = Me.RoomID
sRoomName = Me.RoomName

Forms("frmCabinetDescription").Caption = sRoomName & " Room Parameters"
Forms("frmCabinetDescription").Controls("RoomName").Value = sRoomName

Using the .value at the end of the "RoomName" does not work. Neither does assigning assigning a variable to the room name.

I also tried using a form that what used for another similar program and it worked just fine. But I copied and pasted the code into my troubled DB and the problem began again. I also made a new DB and transfer everything. No luck either. My last thing is to rebuild parts of the DB.

Access is really going downhill on me because of these stupid errors that occur after they have been there for weeks.:mad:
 
Last edited:
Craig,

It sounds like you might be referencing the ControlSource of the control
instead of its Name.

In Design View for you form; is the Name --> RoomName ?

Or is it now something like Text21?

Wayne
 
Neither of those 2 work. I think it might be that the form itself might be corrupt.:(
 
Can you post the db (or at least stripped down to the parts in question)?
 
The coding is pretty easy. It's works great on my other version. No code changes whatsoever. Error code as follows:
Set db = CurrentDb
Set rs = db.OpenRecordset("SystemOptions")
nPercentMargin = rs("PercentMargin")
Set rs = Nothing
Set db = Nothing

DoCmd.OpenForm "frmRoomParameters"

With Forms("frmRoomParameters") Get error 40036 on this line.
.Caption = sJobName Get error 91 since the object has not been set.
.Controls("RoomName").Value = sRoomName Same as above.
End With

I tried copy and paste with my other similar app. No dice..

--Craig
 
Guess I'll ask again -

Can you post the db (or at least stripped down to the parts in question)?

It would be nice to be able to actually play with it to see what might work.
 
I attached a partial version in the attachment part of this email. Certain parts are not included. Also put in the C:\Program Files\CabEstimator folder on your PC. It needs to be created before you can download. Good luck!:confused:
--Craig
 

Attachments

The forms is "frmCustomers".cmdContinue. The code underneath is:
moz-screenshot.jpg
Public Sub cmdContinue_Click()
On Error GoTo err_cleanup

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim nProposalID As Long
Dim nRoomID As Long
Dim sJobName As String
Dim sRoomName As String
Dim sSQL As String
Dim nPercentMargin As Integer

' If ValidateInfo = False Then
' Exit Sub
' End If

sSQL = "DELETE FROM Customers WHERE JobName Is Null"
DoCmd.SetWarnings False
DoCmd.RunSQL sSQL
DoCmd.SetWarnings True

'Just avoiding an error in case "TAB" is pressed taking the cursor to the next record.
If IsNull(Me.fsubRooms.Controls("RoomName")) Then
Set rs = Me.fsubRooms.Form.RecordsetClone
rs.MoveFirst
Me.fsubRooms.Form.Bookmark = rs.Bookmark
End If

With Forms!frmCustomers
nProposalID = !ProposalID
sJobName = !JobName
nRoomID = !fsubRooms.Form!RoomID
sRoomName = !fsubRooms.Form!RoomName
End With

'DoCmd.RunCommand acCmdSaveRecord

Set db = CurrentDb
Set rs = db.OpenRecordset("SystemOptions")
nPercentMargin = rs("PercentMargin")
Set rs = Nothing
Set db = Nothing

DoCmd.OpenForm "frmRoomParameters"
Forms("frmRoomParameters").Caption = sJobName
Forms("frmRoomParameters").Controls("RoomName")=sRoomName

Me.Visible = False

exit_cleanup:
Exit Sub
 

Users who are viewing this thread

Back
Top Bottom