I am having a hard time trying to figure out why my code is not
working properly. I step through the code and check the values when
adding the data to the table, but my Refresh or Requery is not
displaying on the subform. Any suggestions? Thanks for your
help!!!!!!!!!!
********************** Code *************************************
Private Sub cmdOK_Click()
On Error GoTo Err_Handler
If IsNull(Me!txtNote) Then
MsgBox "A blank note cannot be saved.", 16, "ERROR:No Note"
Me!txtNote.SetFocus
Exit Sub
End If
'DoCmd.RunSQL _
'"INSERT IN Notes (CaseSysID,UserSysID,DateCreate,Note)" _
'& " VALUES(" & Me!txtCaseSysID & "," & intUser _
'& ",#" & Format(Date, "m/d/yyyy") & "#,'" & Me!txtNote & "');"
Dim wrkCurrent As Workspace
Dim db As Database
Dim NoteTB As Recordset
Dim fInTrans As Boolean
fInTrans = False
Set wrkCurrent = DBEngine.Workspaces(0)
Set db = CurrentDb()
Set NoteTB = db.OpenRecordset("Notes")
wrkCurrent.BeginTrans
fInTrans = True
With NoteTB
.AddNew
!CaseSysID = Me!txtCaseSysID
!UserSysID = intUser
!DateCreate = Date
!Note = Me!txtNote
.Update
.Move 0, .LastModified
End With
'Debug.Print CaseSysID, UserSysID, DateCreate, Note
wrkCurrent.CommitTrans
fInTrans = False
'frmLoaded!frmEditR.Requery
'Forms!frmEditR!frmNotesSub.Controls!AuditNotes
frmLoaded.refresh
DoCmd.Close acForm, "frmNotesAdd"
frmLoaded.Page8.SetFocus
'If frmLoaded!childAudit.Visible = False Then
'frmLoaded!childAudit.Visible = True
'End If
'Me!DataEntry = True
Err_Handler:
If fInTrans Then
wrkCurrent.Rollback
MsgBox "Error occurred. Note has not been saved!", 16,
"ERROR"
End If
End Sub 2 1914
On 30 Jun 2004 15:38:39 -0700, al*****@nmcourts.com (Debster) wrote:
Get rid of the transaction. It is not necessary for single inserts.
There are not multiple actions which you want to appear as atomic.
To requery the subform:
Me.<subformcontrol>.form.requery
-Tom. I am having a hard time trying to figure out why my code is not working properly. I step through the code and check the values when adding the data to the table, but my Refresh or Requery is not displaying on the subform. Any suggestions? Thanks for your help!!!!!!!!!!
********************** Code *************************************
Private Sub cmdOK_Click() On Error GoTo Err_Handler
If IsNull(Me!txtNote) Then MsgBox "A blank note cannot be saved.", 16, "ERROR:No Note" Me!txtNote.SetFocus Exit Sub End If
'DoCmd.RunSQL _ '"INSERT IN Notes (CaseSysID,UserSysID,DateCreate,Note)" _ '& " VALUES(" & Me!txtCaseSysID & "," & intUser _ '& ",#" & Format(Date, "m/d/yyyy") & "#,'" & Me!txtNote & "');"
Dim wrkCurrent As Workspace Dim db As Database Dim NoteTB As Recordset Dim fInTrans As Boolean
fInTrans = False Set wrkCurrent = DBEngine.Workspaces(0) Set db = CurrentDb() Set NoteTB = db.OpenRecordset("Notes")
wrkCurrent.BeginTrans fInTrans = True
With NoteTB .AddNew !CaseSysID = Me!txtCaseSysID !UserSysID = intUser !DateCreate = Date !Note = Me!txtNote .Update .Move 0, .LastModified End With
'Debug.Print CaseSysID, UserSysID, DateCreate, Note
wrkCurrent.CommitTrans fInTrans = False
'frmLoaded!frmEditR.Requery
'Forms!frmEditR!frmNotesSub.Controls!AuditNotes
frmLoaded.refresh DoCmd.Close acForm, "frmNotesAdd"
frmLoaded.Page8.SetFocus
'If frmLoaded!childAudit.Visible = False Then 'frmLoaded!childAudit.Visible = True 'End If
'Me!DataEntry = True
Err_Handler: If fInTrans Then wrkCurrent.Rollback MsgBox "Error occurred. Note has not been saved!", 16, "ERROR" End If End Sub
Hi Tom,
Thank you for your response. When you say 'get rid of the
transaction', what part of the code are you talkin about? I also
tried the requery without any luck. Do you have any other suggestions
that I may try. Thanks again for your help!
Tom van Stiphout <no*************@cox.net> wrote in message news:<q3********************************@4ax.com>. .. On 30 Jun 2004 15:38:39 -0700, al*****@nmcourts.com (Debster) wrote:
Get rid of the transaction. It is not necessary for single inserts. There are not multiple actions which you want to appear as atomic.
To requery the subform: Me.<subformcontrol>.form.requery
-Tom.
I am having a hard time trying to figure out why my code is not working properly. I step through the code and check the values when adding the data to the table, but my Refresh or Requery is not displaying on the subform. Any suggestions? Thanks for your help!!!!!!!!!!
********************** Code *************************************
Private Sub cmdOK_Click() On Error GoTo Err_Handler
If IsNull(Me!txtNote) Then MsgBox "A blank note cannot be saved.", 16, "ERROR:No Note" Me!txtNote.SetFocus Exit Sub End If
'DoCmd.RunSQL _ '"INSERT IN Notes (CaseSysID,UserSysID,DateCreate,Note)" _ '& " VALUES(" & Me!txtCaseSysID & "," & intUser _ '& ",#" & Format(Date, "m/d/yyyy") & "#,'" & Me!txtNote & "');"
Dim wrkCurrent As Workspace Dim db As Database Dim NoteTB As Recordset Dim fInTrans As Boolean
fInTrans = False Set wrkCurrent = DBEngine.Workspaces(0) Set db = CurrentDb() Set NoteTB = db.OpenRecordset("Notes")
wrkCurrent.BeginTrans fInTrans = True
With NoteTB .AddNew !CaseSysID = Me!txtCaseSysID !UserSysID = intUser !DateCreate = Date !Note = Me!txtNote .Update .Move 0, .LastModified End With
'Debug.Print CaseSysID, UserSysID, DateCreate, Note
wrkCurrent.CommitTrans fInTrans = False
'frmLoaded!frmEditR.Requery
'Forms!frmEditR!frmNotesSub.Controls!AuditNotes
frmLoaded.refresh DoCmd.Close acForm, "frmNotesAdd"
frmLoaded.Page8.SetFocus
'If frmLoaded!childAudit.Visible = False Then 'frmLoaded!childAudit.Visible = True 'End If
'Me!DataEntry = True
Err_Handler: If fInTrans Then wrkCurrent.Rollback MsgBox "Error occurred. Note has not been saved!", 16, "ERROR" End If End Sub This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Matt K. |
last post by:
Hi there,
I have a form in an Access project that contains a subform which
displays the results of a query of the style "select * from
where = #a certain date#". In the main part of the form...
|
by: Robin S. |
last post by:
I tried to ask this question several days ago, but I didn't explain my
application correctly.
Basically I want to have one record from table "A" and I want to display,
say, 5 records from table...
|
by: Aladdin |
last post by:
I have an MS Access form on which I have a listbox listing tables in
that database. I want to be able to click on any of those tables and
view its contents on the same form using subforms or any...
|
by: Robert |
last post by:
Hello Accessors
I have some reports created in Access that are very good for what they do.
However, it seems to me that when you are displaying information you don't
need to print out that a...
|
by: tdmailbox |
last post by:
I have a form with a child form. In the child form there is a list of
names that can grow quite large. On the parent form I want to display
the first name from the child form. I set up a test...
|
by: Shiva |
last post by:
Hi,
My (main)form has a subform that contains the details of the mainform. The
default view of the mainform is 'single form', the default view of the
subform containing the details is...
|
by: Susan Bricker |
last post by:
Greetings!
Still the same application (as previous posts). I worked on the app
while at work (don't tell my boss ... cause this is just for fun and not
work related) and the form was working,...
|
by: Krzysztof Bartosiewicz |
last post by:
Hi!
I haven't been using Access for a very long time and I forgot everything :)
I will be very greatful for help since I have been fighting with this
problem for a few hours...
I have three...
|
by: Typehigh |
last post by:
I am a good programmer, but this one stumps me!
I have a form with a continuous subform. The continuous subform
contains records of data and may reach a depth of 1000's of entities.
I have...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |