473,511 Members | 12,017 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem getting new record from subform to appear on subreport

I have a form that displays general information about an alarm permit
location. There's a subform that shows detailed information about
burglar alarms that have gone off at the location. When a new alarm is
entered on the subform, I want to print a report that shows the general
information and the alarms that were entered.
The record source for the form is the Mailing List table (key is Alarm
#).
The record source for the subform is the Alarms table (key is Alarm #,
Entry #).
The link child fields are Alarm #,Alarm Type; and the link master
fields are Alarm #,Burglar.
The record source for the report is a query (Excessive alarms report
merge) based on the Mailing List table.
The record source for the subreport is another query (Excessive burglar
alarms subreport merge) based on the Mailing List table joined to the
Alarms table, with a one to many relationship between Mailing List and
Alarms.
The link child field is Alarm #, and the link master field is Alarm #.
Now after presenting all of my details, here is my problem.
When I enter my new alarm, and try to print the report, the new record
doesn't show up on the report. In messing around with it, after the
report comes up in print preview (without the record), I tried printing
it (from print preview), and the record shows up! I tried changing the
report to print directly without previewing, and the record does not
show up! I have my print code in the after update event of a control
on the subform:

Private Sub Letter___AfterUpdate()
Dim strCriteria As String
Me![Date Sent].Value = Date
strCriteria = "[Alarm #] = " & Me![Alarm #]
If Me![Letter #].Value = 3 Then
DoCmd.OpenReport "rptFalseAlarm3Burglar", acViewPreview, ,
strCriteria
ElseIf Me![Letter #].Value = 4 Then
DoCmd.OpenReport "rptFalseAlarm4Burglar", acViewPreview, ,
strCriteria
ElseIf Me![Letter #].Value = 5 Then
DoCmd.OpenReport "rptFalseAlarm5Burglar", acViewPreview, ,
strCriteria
ElseIf Me![Letter #].Value = 6 Then
DoCmd.OpenReport "rptFalseAlarm6NonResponse", acViewPreview, ,
strCriteria
End If
End Sub

There are other controls on the subform that appear after the Letter #
(Date Sent and Pmt Recvd), but they aren't Tab Stops. The control
seems to go the the form after the Letter # is entered.
I tried moving the open report code to the form after update and form
after insert (on the subform), and the code didn't execute.
I guess I don't understand where in the order of events that the record
actually gets added, but the fact that the record doesn't show on the
print preview, but it does show after I print the preview is totally
freaking me out!
Does anyone have any ideas?

Nov 13 '05 #1
1 2672
I figured out what was keeping my form after update event from
happening, and when I put my code there, my report prints perfectly.
Now my problem is trying to get the part that was messing up my event
sequence to work again.
In my Letter # control, on the Lost Focus event, a macro was being
executed (I inherited this code). The macro contains a PrintOut Action
(with Selection for the Print Range). This did a perfect "screen
print" of the form with the subform and everything. It also changed
the focus so that my form after update event wasn't firing. It appears
that if I don't execute the PrintOut from a control on the subform, I
end up getting the print out for all of the records in my file, but if
I do execute the PrintOut from a control on the subform, I don't get to
my form after update event. Any ideas now???

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
7944
by: U N Me | last post by:
I have a continuous form that lists records from a query. One of the columns is an amount field, In the footer of the form I place a text box that displays the total (sum) of the amount. The...
2
2832
by: CSDunn | last post by:
Hello, In an Access 2003 ADP Subform, I am trying to set the BackGround color of three textbox fields (LSScore, RScore, WScore) in the current record of the subform to zero (black) if the value of...
4
2589
by: Mark Reed | last post by:
Hi Guru's, Hopefully I can explain this OK.....What I am trying to do is create a QC check sheet using the following fields: ASN, PO & Qty. This information will be at the top of each report with...
4
6969
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the...
3
1778
by: ChadDiesel | last post by:
I've been posting questions here the last week, but if you don't know my situation: I have a "Print Labels" button on the subform that sends the appropriate box information on the subform to a...
1
2049
by: Terry | last post by:
Hello, Has anyone experienced the following problem following an Upsize from Access 97 to SQL 2000 using the MS Upsize Wizard? Or can anyone see what the problem might be. Before Upsize...
9
9667
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a...
3
6579
by: russellhq | last post by:
Hi, I'm fairly new to access and have a little trouble with a crosstab query I've setup. I have a main form where the user selects a project name and below in a subform, a crosstab query is...
2
8089
by: John Sheppard | last post by:
Hello there, I have a report with a subreport on it. The subreport is meant to show multiple child record for each master record. But it only shows the first record. When I open the subreport...
0
7251
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7148
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...
0
7367
Oralloy
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,...
1
5072
isladogs
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...
0
4743
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...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3217
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1581
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
451
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.