Hello and TIA for any help with this non profit Christmas assistance
project.
I have an applicant (app history) and child (child history) tables (4
total). I need to grab the next available (in house case number, appt
date and time) for the applicants yearly history and the childs yearly
history and then print a report with the applicants info and this in
house case number. The forms are linked with ID_app (from the
applicant table).
I can grab the number using DMIN and update my case number table, it
populates the applicant table but I run into problems with the child
history and the report. On the first try, the child history record
case number is blank, if I run the code again, then applicant history
record increments but the child history record is getting the previous
case number. The forms are a main form with a tab control. The first
page has a subform within a subform (child and child yearly history).
The second page has a subform (applicant yearly history). The report
is also falling into the same trap as the child history.
I enter some data into the child history form, then go to the
applicant history form. This is where the code starts from, grad the
case nbr, update the case nbr table, update the child record(s) print
the report.
Here is the code I am using - I tried both the query def and pure SQL,
neither works in the code. But the query works if I run it with the
form open, the child record get the correct case number and the report
prints the right info.
Private Sub cmdAssgnCaseNbr _Click()
'assign case number - use next avail from tbl_ToyShop_Cas eNbrs
'update eligible child records with the same case number
'print the appointment and signature forms
Dim response
Dim result_YesNO
Dim db As Database
Dim qd1 As QueryDef
Dim qd2 As QueryDef
Dim rst As Recordset
Set db = CurrentDb
Set qd1 = db.QueryDefs("q ry_ToyShop_Case Nbrs_Update")
Set qd2 = db.QueryDefs("q ry_ToyShop_Case Nbrs_Update_Chi ld")
'Message box check Data Entry if all okay continue
If caseNbr_assign( result_YesNO) = vbYes Then
'Assign the case nbr and save the applicant record
Me.[Applicant_House hold_Info].Form![int_caseNbr] =
DMin("int_caseN br", "tbl_ToyShop_Ca seNbrs",
"IsNull([tbl_ToyShop_Cas eNbrs].[dte_assgnd])")
Me.[Applicant_House hold_Info].Form![dte_giftsAppt] =
DMin("dte_appt" , "tbl_ToyShop_Ca seNbrs",
"IsNull([tbl_ToyShop_Cas eNbrs].[dte_assgnd])")
Me.[Applicant_House hold_Info].Form![dte_giftsTime] =
DMin("dte_Time" , "tbl_ToyShop_Ca seNbrs",
"IsNull([tbl_ToyShop_Cas eNbrs].[dte_assgnd])")
Me.ynShareInfo. Value = True
DoCmd.Save
'Run the update query to take the case number out of the
pool
qd1.Parameters( "[forms]![frm_applicant]![Applicant
Household Info].[form]![int_caseNbr]") = Me.Applicant_Ho usehold_Info.
[Form]![int_caseNbr]
qd1.Execute
DoCmd.SetWarnin gs False ' turn off user prompts
DoCmd.OpenQuery "qry_ToyShop_Ca seNbrs_Update"
'Run the update query to assign the case number to
the child's record
qd2.Parameters( "[forms]![frm_applicant].[id_app]")
= Me.ID_app
qd2.Execute
DoCmd.OpenQuery
"qry_ToyShop_Ca seNbrs_Update_C hild"
DoCmd.SetWarnin gs True ' turn off user prompts
'DoCmd.RunSQL "UPDATE tbl_Applicant_H istory INNER
JOIN (tbl_Child_Hist ory INNER JOIN tbl_Child ON
tbl_Child_Histo ry.ID_child = tbl_Child.ID_ch ild) ON
tbl_Applicant_H istory.ID_app = tbl_Child.ID_ap p SET
tbl_Child_Histo ry.int_caseNbr = tbl_applicant_h istory.int_case nbr
WHERE (((tbl_Child_Hi story.int_appYr )=Year(Date())) AND
((tbl_Child.ID_ app)=[forms]![frm_applicant].[id_app]) AND
((tbl_Applicant _History.int_ap pYr)=Year(Date( ))));"
'Print the Signature and Appointment Form
DoCmd.OpenRepor t "rpt_ToyShop_Ap ptSigForms"
Else
DoCmd.CancelEve nt
End If
End Sub
Thanks for any help - Liz 0 2043 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: vishnu mahendra |
last post by:
I have two table both say A and B.
If i insert a record in A that record should be inserted in B.
If i delete a record in A that record should be deleted from B.
Is that possible.If yes please tell me.
Thankyou in advance,
vishnu
|
by: Stuart McGraw |
last post by:
I haven't been able to figure this out and would
appreciate some help...
I have two tables, both with autonumber primary
keys, and linked in a conventional master-child
relationship. I've created forms for both those
tables, and inserted the child table form into the
master table form as a subform. It works just as
it is supposed to, in that I can create a new master
record, and then add detail records.
|
by: pete matthews |
last post by:
HI. I have a dataset with two tables. Table 1 is parent and table 2 is
child. Am populating a single datagrid with records from child table
derived from a single parent record. I am then allowing users to edit
child records in datagrid. Users have an update option for each row in
the datagrid. How do I then write the updated child record from the
datagrid to the dataset
??? The user presses an update button which fires the itemcommand. I...
|
by: PAUL |
last post by:
Hello,
I have 2 tables with a relationship set up in the dataset with vb
..net. I add a new record to the parent table then edit an existing child
record to have the new parent ID. However when I do the update the changed
parentid in the child table fails to change. No error is given its just that
the change is not written to the Database.
When I step through the records for the child table the one I would expect
to be changed has a row...
|
by: Kevin |
last post by:
I've got an mdiParent form. I open an instance of a child form like
this:
Dim frmChild as New frmCustomers
frmChild.Show()
I've got a few of these open at a time. On each frmChild I open
another form that displays customer data. When I make changes and save
the customer data, I need the updated data to show on the correct
frmChild. How do I know which form opened the customer data form and
| |
by: Swinky |
last post by:
I hope someone can help...I feel like I'm walking in the dark without a
flashlight (I'm NOT a programmer but have been called to task to do
some work in Access that is above my head).
I have code that will successfully copy a record and append the
information to a new record in the same table (parent table) within a
form. However, there are related child tables with primary keys (set
to Autonumber) stored in sub-forms. That information...
|
by: =?Utf-8?B?a2VubmV0aG1Abm9zcGFtLm5vc3BhbQ==?= |
last post by:
vs2005, c#
Trying to understand why one way works but the other doesnt.
I have not tried to create a simpler mdi/child/showdialog app for posting
purposes (I think even this would not be so small or simple). I am hoping
the description will generate some ideas I can check out.
PROBLEM:
-----------------
Switching to UI thread using Invoke(), everything seems good.
|
by: Harlequin |
last post by:
I have a question concerning the need to trigger events within a "child" subform which is itself enbedded within a master "parent" form and which is accessible via a tab in the parent form. Becuase this is all very difficult to explain in words, please bear with me as I endevour to explain what it is I am trying to do. It would be helpful if I could attach a graphics file to this posting that would help explain what it is I'm trying to achieve...
|
by: OldBirdman |
last post by:
I have a form with several bound textboxes. These are routinely updated by User. The table in RecordSource for this form currently has 8 fields not shown on this form, but which occasionally need to be changed by User. For this I have created an "Advanced" commandbutton, which opens a child form with controls to display the remaining fields.
I tried using recordsetclone to put the child form on the same record and recordset as the main...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |