A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Trying to add new Transaction code



 
 
Thread Tools Display Modes
  #21  
Old December 24th, 2004, 12:48 AM
Andi Mayer
external usenet poster
 
Posts: n/a
Default

On Thu, 23 Dec 2004 18:17:35 -0500, "Jan Il"
wrote:

is the input everytime a Number? (NewData)
is the field Transaction numeric?


I changed also the Docmd.openform

Private Sub Combo0_NotInList(NewData As String, Response As Integer)
On Error GoTo Err_Handler
Dim rst As DAO.Recordset
Dim lngTransaction As Long

If MsgBox(NewData & " ... not in list, add it?", _
vbOKCancel, "New Transaction") = vbOK Then
Set rst = CurrentDb.OpenRecordset("MyCheckRegister")
With rst
.AddNew
.Fields("Transaction") = NewData
If IsNull(Me.txtTransactionDate) Then
.Fields("TransactionDate") = Now()
' .Fields("TransactionDate") =#1/1/1900#

Else
.Fields("TransactionDate") = _
Format(Me.txtTransactionDate, "\#mm\/dd\/yyyy\ hh\:nn\:ss\#")
End If
.Update
' .Bookmark = .LastModified
' lngTransaction = .Fields("Transaction")
.Close
End With
Response = acDataErrAdded
DoCmd.OpenForm "frmCkEntry", , , "Transaction =" _
& NewData, , acDialog
Else
Response = acDataErrContinue
End If

Exit_He
Set rst = Nothing
Exit Sub
Err_Handler:
Response = acDataErrContinue
MsgBox "Error: " & Err.Description
Resume Exit_Here
End Sub


BTW: its nearly 1' o'clock in the night at my timezone, therefore I am
going to sleep now

read you tomorrow


---
If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
  #22  
Old December 24th, 2004, 01:01 AM
Jan Il
external usenet poster
 
Posts: n/a
Default

Hi Andi :-)

On Thu, 23 Dec 2004 12:59:42 -0500, "Jan Il"
wrote:

please post the whole function, there must be a typo somewhere


Here is the entire code for the NotInList Event for the cmbTransaction
control:
~~~~~~~~~~~
Private Sub cmbTransaction_NotInList(NewData As String, Response As Integer)
On Error GoTo Err_Handler
Dim rst As DAO.Recordset
Dim lngTransaction As Long

If MsgBox(NewData & " ... not in list, add it?", _
vbOKCancel, "New Transaction") = vbOK Then
Set rst = CurrentDb.OpenRecordset("MyCheckRegister")
With rst
.AddNew
.Fields("Transaction") = NewData
If IsNull(Me.txtTransactionDate) Then
.Fields("TransactionDate") = Now()
'.Fields("TransactionDate") = #1/1/1900#
Else
.Fields ("TransactionDate")
.Update
.Bookmark = .LastModified
lngTransaction = .Fields("Transaction")
.Close
End With
Response = acDataErrAdded
DoCmd.OpenForm FormName:="frmCkEntry", _
wherecondition:="Transaction =" & lngTransaction, _
WindowMode:=acDialog
Else
Response = acDataErrContinue
End If

Exit_He
Set rst = Nothing
Exit Sub
Err_Handler:
Response = acDataErrContinue
MsgBox "Error: " & Err.Description
Resume Exit_Here
End Sub
~~~~~~~~

Jan



  #23  
Old December 24th, 2004, 03:25 AM
Jan Il
external usenet poster
 
Posts: n/a
Default

Hi you guys..

I will be going to FL for the Christmas weekend tomorrow morning, so I will
not be able to respond after the morning. But, I will check back here when
I return the first of next week.

Thank you all for your time and assistance. I wish you, and your families,
a very Happy Holiday. :-)

Jan


On Thu, 23 Dec 2004 12:59:42 -0500, "Jan Il"
wrote:

please post the whole function, there must be a typo somewhere
---
If you expect an answer to a personal mail, add the word "manfred" to the

first 10 lines in the message
MW



  #24  
Old January 3rd, 2005, 05:11 AM
Jan Il
external usenet poster
 
Posts: n/a
Default

Hi Andi :-)

On Thu, 23 Dec 2004 18:17:35 -0500, "Jan Il"
wrote:

is the input everytime a Number? (NewData)
is the field Transaction numeric?


I changed also the Docmd.openform

Private Sub Combo0_NotInList(NewData As String, Response As Integer)
On Error GoTo Err_Handler
Dim rst As DAO.Recordset
Dim lngTransaction As Long

If MsgBox(NewData & " ... not in list, add it?", _
vbOKCancel, "New Transaction") = vbOK Then
Set rst = CurrentDb.OpenRecordset("MyCheckRegister")
With rst
.AddNew
.Fields("Transaction") = NewData
If IsNull(Me.txtTransactionDate) Then
.Fields("TransactionDate") = Now()
' .Fields("TransactionDate") =#1/1/1900#

Else
.Fields("TransactionDate") = _
Format(Me.txtTransactionDate, "\#mm\/dd\/yyyy\ hh\:nn\:ss\#")
End If
.Update
' .Bookmark = .LastModified
' lngTransaction = .Fields("Transaction")
.Close
End With
Response = acDataErrAdded
DoCmd.OpenForm "frmCkEntry", , , "Transaction =" _
& NewData, , acDialog
Else
Response = acDataErrContinue
End If

Exit_He
Set rst = Nothing
Exit Sub
Err_Handler:
Response = acDataErrContinue
MsgBox "Error: " & Err.Description
Resume Exit_Here
End Sub


BTW: its nearly 1' o'clock in the night at my timezone, therefore I am
going to sleep now

read you tomorrow


Sorry to be so long in getting back to you. I had a last minute invite to
Ft. Myers, FL for a Christmas week holiday. No way was I passing it up,
'specailly when it was 22 degrees here in Warrenton, VA, and 70 in Ft.
Myers. Just got back late this afternoon, so catching up. I'll try this in
the morning and let you know how it goes. Hope you haven't lost interest,
and that you had a wonderful Christmas and New Years holiday.

Thank you for your time and assistance, I really do appreciate it. Again,
sorry to leave you in the dark for so long....... g

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


  #25  
Old January 3rd, 2005, 10:33 AM
Andi Mayer
external usenet poster
 
Posts: n/a
Default

On Sun, 2 Jan 2005 23:11:46 -0500, "Jan Il"
wrote:

Hi Jan you are a lucky guy ;-)

I had marked this message as ignored and while I was pressing the
I-button I saw a Andi at the top and went back.

I sought this problem was solved.

First of all:
Every time when you change something in you code: COMPILE this code

in your case: you would have run into a compile error like:

there is an ENDIF missing (I am to lazy to start my English version to
give you the exact error message)

second: on top of every module there should be: option explizit

with this two words, you can't use un-Dimmed variables (this is very
helpfull to avoid typing errors, besides that you can't use
uninitialized variables and objects)


---
If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
  #26  
Old January 4th, 2005, 02:26 AM
Jan Il
external usenet poster
 
Posts: n/a
Default

Hi Andi!

Hi Jan you are a lucky guy ;-)


Gal ;o) And.....thank you so much for checking back. Hope you'll hang
tight a bit...I had a tad of problems with my machine today, just being
contrary that I left it alone so long over the holidays I guess. g I
didn't get a chance to work with the new information you have been so kind
to provide, yet, but, I'll give it a go now and let you know what gives as
soon as I can.

Thank you for your valuable time and help.....I *really* do appreciate it.
:-))

Jan


  #27  
Old January 4th, 2005, 11:12 AM
Andi Mayer
external usenet poster
 
Posts: n/a
Default

On Mon, 3 Jan 2005 20:26:20 -0500, "Jan Il"
wrote:

Hi Andi!

Hi Jan you are a lucky guy ;-)


Gal ;o) And.....thank you so much for checking back. Hope you'll hang

So lets wait till your Compi loves you again.

If you don't wait another 6 days this thread will still be active in
my newsreader and marked for watching

---
If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
  #28  
Old January 4th, 2005, 04:17 PM
Jan Il
external usenet poster
 
Posts: n/a
Default

Hi Andi :-)
Hi Jan you are a lucky guy ;-)


Gal ;o) And.....thank you so much for checking back. Hope you'll hang

So lets wait till your Compi loves you again.


If you don't wait another 6 days this thread will still be active in
my newsreader and marked for watching


Not sure about the love part on either end.....but....we made up and we're
talking again...so far. ;o)

'k......

In regards to the first two questions of your previous reply, if I
understand correctly::

is the input everytime a Number? (NewData)

No....this is a text data type field.

is the field Transaction numeric?

No...this is a text data type field

I have tried the new code in the NotInList event of the cmbTransaction
control, but, when I enter a check number, such as 2001, tab to the next
control and enter the date, then tab to the Transaction control and enter
the new information, then try to tab to the next control, I get an error
that says: Data type conversion error.

Thank you.

Jan


---
If you expect an answer to a personal mail, add the word "manfred" to the

first 10 lines in the message
MW



  #29  
Old January 4th, 2005, 04:37 PM
Andi Mayer
external usenet poster
 
Posts: n/a
Default

On Tue, 4 Jan 2005 10:17:44 -0500, "Jan Il"
wrote:


I have tried the new code in the NotInList event of the cmbTransaction
control, but, when I enter a check number, such as 2001, tab to the next
control and enter the date, then tab to the Transaction control and enter
the new information, then try to tab to the next control, I get an error
that says: Data type conversion error.


and once again you didn't told on which line

I guess:
DoCmd.OpenForm "frmCkEntry", , , "Transaction =" & NewData, ,
acDialog

a string has to be in qutes: therefore

DoCmd.OpenForm "frmCkEntry", , , "Transaction ='" & NewData &"'",
, acDialog

we will give him what he wants.

BTW: how big is your mdb after zipping it?
---
If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
  #30  
Old January 4th, 2005, 05:14 PM
Jan Il
external usenet poster
 
Posts: n/a
Default

Hi Andi :-)

I have tried the new code in the NotInList event of the cmbTransaction
control, but, when I enter a check number, such as 2001, tab to the next
control and enter the date, then tab to the Transaction control and enter
the new information, then try to tab to the next control, I get an error
that says: Data type conversion error.


and once again you didn't told on which line


W'll.....I can't tell you which 'line', as again, it does not give any line
reference information as to what part of the code is causing the error. All
the error message consists of is: Error: Data type converstion error. That's
all. g

I guess:
DoCmd.OpenForm "frmCkEntry", , , "Transaction =" & NewData, ,
acDialog

a string has to be in qutes: therefore

DoCmd.OpenForm "frmCkEntry", , , "Transaction ='" & NewData &"'",
, acDialog

we will give him what he wants.


'k.....I cut and pasted the above code, making sure it is all on one line,
and I still get the same error message. Again, it is not giving any line
reference as to what is causing the error.

BTW: how big is your mdb after zipping it?


I'm using a sample test copy, which has limited files for test purposes, so
it's only 166 KB zipped.

Jan


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Barcodes TarponZeke General Discussion 4 October 25th, 2004 08:04 PM
Form to generate a Report code Pat Coleman Setting Up & Running Reports 4 July 16th, 2004 12:58 PM
Hide or show Control Button on Form in Access 97 Pete Sperling Using Forms 8 July 13th, 2004 04:13 PM
Is it possible to include Begin And End Transaction code in VBA ? Jean New Users 10 June 29th, 2004 11:31 PM


All times are GMT +1. The time now is 06:33 PM.


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