Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Boxes on form. Datatypes error I think

Hi,

I have 10 rows of a combobox and 2 text boxes on form1
On each row the combobox is called AccA , DebA, CrdA
next row is AccB , DebB, CrdB.......
I'm trying to write a small bit of code that checks if either DebA or
CrdA < null or blank then there must be a value in AccA. Else display
msbox "Error".
Now check the next line.

I've tried this to no avail.

Public myletter as string

Private Sub but_post_Click()
If form1.Balance < 0 Then
MsgBox "Please ensure that the journal balances to zero before posting"
End
Else

'Now this is where I start getting errors
myletter = "A"
test_acc_incl
myletter = "B"
test_acc_incl


End If



End Sub

Sub test_acc_incl()
Dim Debletter As Object
Dim Crdletter As Object
Dim Accletter As Object
' I tried using the 3 dims as string and variables but that didn't work

Deb = "form1.Deb" & myletter
Crd = "form1.Crd" & myletter
Acc = "form1.Acc" & myletter

Set Debletter = Deb
Set Crdletter = Crd
Set Accletter = Acc

If Debletter < Null Or Crdletter < Null Then
If Accletter = Null Then
MsgBox "Error"

Else
End If

Else
End If
End Sub

Please help,

Thanks,

marc

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Boxes on form. Datatypes error I think

set debLetter = form1.Controls("Deb" & myletter).Value
set crdLetter = form1.Controls("Crd" & myLetter).Value


--
Regards,
Tom Ogilvy


"marcbell" wrote in message
oups.com...
Hi,

I have 10 rows of a combobox and 2 text boxes on form1
On each row the combobox is called AccA , DebA, CrdA
next row is AccB , DebB, CrdB.......
I'm trying to write a small bit of code that checks if either DebA or
CrdA < null or blank then there must be a value in AccA. Else display
msbox "Error".
Now check the next line.

I've tried this to no avail.

Public myletter as string

Private Sub but_post_Click()
If form1.Balance < 0 Then
MsgBox "Please ensure that the journal balances to zero before posting"
End
Else

'Now this is where I start getting errors
myletter = "A"
test_acc_incl
myletter = "B"
test_acc_incl


End If



End Sub

Sub test_acc_incl()
Dim Debletter As Object
Dim Crdletter As Object
Dim Accletter As Object
' I tried using the 3 dims as string and variables but that didn't work

Deb = "form1.Deb" & myletter
Crd = "form1.Crd" & myletter
Acc = "form1.Acc" & myletter

Set Debletter = Deb
Set Crdletter = Crd
Set Accletter = Acc

If Debletter < Null Or Crdletter < Null Then
If Accletter = Null Then
MsgBox "Error"

Else
End If

Else
End If
End Sub

Please help,

Thanks,

marc



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Boxes on form. Datatypes error I think

Hi Marchell,

Perhaps you could also try something like:

Sub Tester()
Dim i As Long
Dim x As Double, y As Double, z As Double

For i = 65 To 74 'Asc("A") to Asc("J")
Me.Controls("Acc" & Chr(i)).Value = x
Me.Controls("Deb" & Chr(i)).Value = y
Me.Controls("Crd" & Chr(i)).Value = z

If x < y - z Then
MsgBox "Out of Balance"
End If
Next

End Sub


---
Regards,
Norman



"marcbell" wrote in message
oups.com...
Hi,

I have 10 rows of a combobox and 2 text boxes on form1
On each row the combobox is called AccA , DebA, CrdA
next row is AccB , DebB, CrdB.......
I'm trying to write a small bit of code that checks if either DebA or
CrdA < null or blank then there must be a value in AccA. Else display
msbox "Error".
Now check the next line.

I've tried this to no avail.

Public myletter as string

Private Sub but_post_Click()
If form1.Balance < 0 Then
MsgBox "Please ensure that the journal balances to zero before posting"
End
Else

'Now this is where I start getting errors
myletter = "A"
test_acc_incl
myletter = "B"
test_acc_incl


End If



End Sub

Sub test_acc_incl()
Dim Debletter As Object
Dim Crdletter As Object
Dim Accletter As Object
' I tried using the 3 dims as string and variables but that didn't work

Deb = "form1.Deb" & myletter
Crd = "form1.Crd" & myletter
Acc = "form1.Acc" & myletter

Set Debletter = Deb
Set Crdletter = Crd
Set Accletter = Acc

If Debletter < Null Or Crdletter < Null Then
If Accletter = Null Then
MsgBox "Error"

Else
End If

Else
End If
End Sub

Please help,

Thanks,

marc



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Boxes on form. Datatypes error I think

did you mean:

Sub Tester()
Dim i As Long
Dim x As Double, y As Double, z As Double

For i = 65 To 74 'Asc("A") to Asc("J")
x = Me.Controls("Acc" & Chr(i)).Value
y = Me.Controls("Deb" & Chr(i)).Value
z = Me.Controls("Crd" & Chr(i)).Value

If x < y - z Then
MsgBox "Out of Balance"
End If
Next

End Sub

Also, an equality check for doubles/calculated double may not be very
satisfying.

--
Regards,
Tom Ogilvy


"Norman Jones" wrote in message
...
Hi Marchell,

Perhaps you could also try something like:

Sub Tester()
Dim i As Long
Dim x As Double, y As Double, z As Double

For i = 65 To 74 'Asc("A") to Asc("J")
Me.Controls("Acc" & Chr(i)).Value = x
Me.Controls("Deb" & Chr(i)).Value = y
Me.Controls("Crd" & Chr(i)).Value = z

If x < y - z Then
MsgBox "Out of Balance"
End If
Next

End Sub


---
Regards,
Norman



"marcbell" wrote in message
oups.com...
Hi,

I have 10 rows of a combobox and 2 text boxes on form1
On each row the combobox is called AccA , DebA, CrdA
next row is AccB , DebB, CrdB.......
I'm trying to write a small bit of code that checks if either DebA or
CrdA < null or blank then there must be a value in AccA. Else display
msbox "Error".
Now check the next line.

I've tried this to no avail.

Public myletter as string

Private Sub but_post_Click()
If form1.Balance < 0 Then
MsgBox "Please ensure that the journal balances to zero before posting"
End
Else

'Now this is where I start getting errors
myletter = "A"
test_acc_incl
myletter = "B"
test_acc_incl


End If



End Sub

Sub test_acc_incl()
Dim Debletter As Object
Dim Crdletter As Object
Dim Accletter As Object
' I tried using the 3 dims as string and variables but that didn't work

Deb = "form1.Deb" & myletter
Crd = "form1.Crd" & myletter
Acc = "form1.Acc" & myletter

Set Debletter = Deb
Set Crdletter = Crd
Set Accletter = Acc

If Debletter < Null Or Crdletter < Null Then
If Accletter = Null Then
MsgBox "Error"

Else
End If

Else
End If
End Sub

Please help,

Thanks,

marc





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Boxes on form. Datatypes error I think

Hi Tom,

Yes I did.!

I discovered the manifest error as soon as iI tested, but still managed to
post the unrevised code.

I actually read my own post and failed to spot that I had pasted the wrong
code.

Thank you for picking it up,.


---
Regards,
Norman



"Tom Ogilvy" wrote in message
...
did you mean:

Sub Tester()
Dim i As Long
Dim x As Double, y As Double, z As Double

For i = 65 To 74 'Asc("A") to Asc("J")
x = Me.Controls("Acc" & Chr(i)).Value
y = Me.Controls("Deb" & Chr(i)).Value
z = Me.Controls("Crd" & Chr(i)).Value

If x < y - z Then
MsgBox "Out of Balance"
End If
Next

End Sub

Also, an equality check for doubles/calculated double may not be very
satisfying.

--
Regards,
Tom Ogilvy


"Norman Jones" wrote in message
...
Hi Marchell,

Perhaps you could also try something like:

Sub Tester()
Dim i As Long
Dim x As Double, y As Double, z As Double

For i = 65 To 74 'Asc("A") to Asc("J")
Me.Controls("Acc" & Chr(i)).Value = x
Me.Controls("Deb" & Chr(i)).Value = y
Me.Controls("Crd" & Chr(i)).Value = z

If x < y - z Then
MsgBox "Out of Balance"
End If
Next

End Sub


---
Regards,
Norman



"marcbell" wrote in message
oups.com...
Hi,

I have 10 rows of a combobox and 2 text boxes on form1
On each row the combobox is called AccA , DebA, CrdA
next row is AccB , DebB, CrdB.......
I'm trying to write a small bit of code that checks if either DebA or
CrdA < null or blank then there must be a value in AccA. Else display
msbox "Error".
Now check the next line.

I've tried this to no avail.

Public myletter as string

Private Sub but_post_Click()
If form1.Balance < 0 Then
MsgBox "Please ensure that the journal balances to zero before posting"
End
Else

'Now this is where I start getting errors
myletter = "A"
test_acc_incl
myletter = "B"
test_acc_incl


End If



End Sub

Sub test_acc_incl()
Dim Debletter As Object
Dim Crdletter As Object
Dim Accletter As Object
' I tried using the 3 dims as string and variables but that didn't work

Deb = "form1.Deb" & myletter
Crd = "form1.Crd" & myletter
Acc = "form1.Acc" & myletter

Set Debletter = Deb
Set Crdletter = Crd
Set Accletter = Acc

If Debletter < Null Or Crdletter < Null Then
If Accletter = Null Then
MsgBox "Error"

Else
End If

Else
End If
End Sub

Please help,

Thanks,

marc







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
User Form Text Boxes - Copy format of text boxes NDBC Excel Discussion (Misc queries) 3 July 2nd 09 02:02 AM
VBA for form check boxes dicko1 Excel Worksheet Functions 4 June 5th 09 04:02 PM
Arrays/Functions/Different datatypes in a formula? Jess Excel Worksheet Functions 3 November 13th 06 10:15 AM
combo boxes on a form Russell-stanely Excel Discussion (Misc queries) 3 July 5th 05 09:13 PM
textboxes and datatypes Rob Excel Programming 2 February 17th 04 09:33 AM


All times are GMT +1. The time now is 06:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"