View Single Post
  #5  
Old November 21st, 2004, 08:14 PM
Jan Il
external usenet poster
 
Posts: n/a
Default

Hi Steve :-)

"Steve Schapel" wrote in message
...
Jan

There would probably be a number of ideas of tackling this sort of
stuff. One would be to make an Option Group with 3 toggle buttons
labelled Checks, DBTs, and All. On the after Update event of this
Option Group, you could use code which either toggles the Record Source
of the form, or the Filter. For example...
Select Case Me.YourOptionGroup
Case 1
Me.RecordSource = "SELECT * FROM YourQuery WHERE txtCheckNo Not
Like 'DBT*'"
Case 1
Me.RecordSource = "SELECT * FROM YourQuery WHERE txtCheckNo
Like 'DBT*'"
Case 1
Me.RecordSource = "YourQuery"
End Select

or...
Select Case Me.YourOptionGroup
Case 1
Me.Filter = "txtCheckNo Not Like 'DBT*'"
Me.FilterOn = True
Case 1
Me.Filter = "txtCheckNo Like 'DBT*'"
Me.FilterOn = True
Case 1
Me.FilterOn = False
End Select


Thank you very much for the information. I'll give these a go and see how I
get along with them. I'll check back with you. :-)

Jan
Smiles are meant to be shared,
that's why they're so contagious.

--
Steve Schapel, Microsoft Access MVP


Jan Il wrote:
Hi Steve :-)



Jan,

How do you tell if it is a Check or DBT transaction?



In the table field I can enter DBT for the debit card pruchase, or the

check
number, i.e., 1002 or DBT.

In the Entry form, when the DBT is entered into the CheckNo control, the
code in the dorms module adds a number to it so that it is then a

sortable
AlphaNumerical entry, such as DBT00001. Thus, it can separate the DBT
transaction entries from the Check numbers and make them also sortable
numerically. Here is the code for the form module.

Option Explicit

Private Function NextDBTNumber() As String

' This function finds the highest "DBT" check number currently on
' file and adds 1 to it to get a new DBT number.

Dim strMaxNum As String

strMaxNum = vbNullString & _
DMax("CheckNo", "MyCheckRegister", _
"CheckNo Like 'DBT*'")

If Len(strMaxNum) = 0 Then
NextDBTNumber = "DBT000001"
Else
NextDBTNumber = _
"DBT" & Format(1 + CLng(Mid(strMaxNum, 4)), "000000")
End If

End Function


And here is the code for the txtCheckNo control on the form:

Private Sub txtCheckNo_AfterUpdate()

With Me!txtCheckNo
If .Value = "DBT" _
And IsNull(.OldValue) _
Then
.Value = NextDBTNumber()
End If
End With

End Sub

So, what I need to do is to be able to sort just the DBTxxx entries

separate
from the Check number entries in this field using a combo box
(cmbDBTExpense) and command button (cmdDBTExpense) that will display

just
the DBT transactions in the record form. This way I can call up

individual
transactions by date from the filter form, or all of the checks, or all

of
the DBT transactions separately from the filter form controls.


Thank you very much for your time and assistance, I truly appreciate it.

Jan
Smiles are meant to be shared,
that's why they're so contagious.