justagrunt
Technical User
- Oct 10, 2002
- 132
Hi,
Private module attached to an access form called up by a control. All variables are global and the excel sheet does open and activates the activecell. I have taken a subroutine and dumped it back into the main body of the routine.
The following gives me an error 1004 Application-defined or object defined error at line,
rng11=activecell.offset(c,0)
Which is part of
Case Is = 100
Call Open_Excel
Set rng4 = Sheets(2).Range("e4:e75")
Sheets(2).Range("e4").Activate
z = ""
z = ActiveCell.Value
MsgBox " equals " & z, vbOKOnly 'check it's working
'CHECK MESSAGE BOX FOR DEBUGG
MsgBox "Ok back in main. Ok to here", vbOKOnly ' and start sub routine "Price2-Way
'look at the material option
If (Forms![tubeselectform]![Grade] = 1) Then 'non sanitary mild steel
c = -3
ElseIf (Forms![tubeselectform]![Grade] = 2) Then ' non sanitary 304
c = -4
ElseIf (Forms![tubeselectform]![Grade] = 3) Then '316 stst option.
c = -8
Else
'do nothing
End If
rng11 = ActiveCell.Offset(c, 0)
res = ""
res = rng11.Value
'rng11 is the value to be copied to field Forms![tubeselectform]![Price_Tube_Size)
Forms![tubeselectform]![Price_Tube_Size] = res
'now look at the Cover option
If (Forms![tubeselectform]![Cover] = 2) Then 'cover is 304 ss
c = -30
ElseIf (Forms![tubeselectform]![Cover] = 3) Then ' cover is 316 ss
c = -31
Else
c = -1
End If
rng21 = ActiveCell.Offset(c, 0)
res2 = ""
res2 = rng21.Value
'rng21 is the value to be copied to field Forms![tubeselectform]![Price_Cover_Option]and will be numeric.
Forms![tubeselectform]![Price_Cover_Option] = res2
'now look at the Controller option
If (Forms![tubeselectform]![DC] = True) Then
c = -29
ElseIf (Forms![tubeselectform]![DC] = False) Then
c = -28
Else
'do nothing
End If
rng31 = ActiveCell.Offset(c, 0)
res3 = ""
res3 = rng31.Value
'rng31 is the value to be copied to field Forms![tubeselectform]![Price_Prologic)
Forms![tubeselectform]![Price_Prologic] = res3
Rem Price_2way
Case Is = 125
Call Open_Excel
Set rng5 = Sheets(2).Range("f4:f75")
Sheets(2).Range("f4").Activate
Price_2way
Cheers
Any Thoughts
Bill
Private module attached to an access form called up by a control. All variables are global and the excel sheet does open and activates the activecell. I have taken a subroutine and dumped it back into the main body of the routine.
The following gives me an error 1004 Application-defined or object defined error at line,
rng11=activecell.offset(c,0)
Which is part of
Case Is = 100
Call Open_Excel
Set rng4 = Sheets(2).Range("e4:e75")
Sheets(2).Range("e4").Activate
z = ""
z = ActiveCell.Value
MsgBox " equals " & z, vbOKOnly 'check it's working
'CHECK MESSAGE BOX FOR DEBUGG
MsgBox "Ok back in main. Ok to here", vbOKOnly ' and start sub routine "Price2-Way
'look at the material option
If (Forms![tubeselectform]![Grade] = 1) Then 'non sanitary mild steel
c = -3
ElseIf (Forms![tubeselectform]![Grade] = 2) Then ' non sanitary 304
c = -4
ElseIf (Forms![tubeselectform]![Grade] = 3) Then '316 stst option.
c = -8
Else
'do nothing
End If
rng11 = ActiveCell.Offset(c, 0)
res = ""
res = rng11.Value
'rng11 is the value to be copied to field Forms![tubeselectform]![Price_Tube_Size)
Forms![tubeselectform]![Price_Tube_Size] = res
'now look at the Cover option
If (Forms![tubeselectform]![Cover] = 2) Then 'cover is 304 ss
c = -30
ElseIf (Forms![tubeselectform]![Cover] = 3) Then ' cover is 316 ss
c = -31
Else
c = -1
End If
rng21 = ActiveCell.Offset(c, 0)
res2 = ""
res2 = rng21.Value
'rng21 is the value to be copied to field Forms![tubeselectform]![Price_Cover_Option]and will be numeric.
Forms![tubeselectform]![Price_Cover_Option] = res2
'now look at the Controller option
If (Forms![tubeselectform]![DC] = True) Then
c = -29
ElseIf (Forms![tubeselectform]![DC] = False) Then
c = -28
Else
'do nothing
End If
rng31 = ActiveCell.Offset(c, 0)
res3 = ""
res3 = rng31.Value
'rng31 is the value to be copied to field Forms![tubeselectform]![Price_Prologic)
Forms![tubeselectform]![Price_Prologic] = res3
Rem Price_2way
Case Is = 125
Call Open_Excel
Set rng5 = Sheets(2).Range("f4:f75")
Sheets(2).Range("f4").Activate
Price_2way
Cheers
Any Thoughts
Bill