Two Combox Single Source

KerryDee

Registered User.
Local time
Today, 09:39
Joined
Nov 24, 2016
Messages
36
Hi I appreciate any help I could receive for my problem in the attached DB:


Form---The Report shows Replacement and Correction Combo Boxes. The user can only choose either a Replacement or Correction field. I received the code for the user to choose either combo box from Access World, as seen on the form.

Report---The problem I am having is that I need to create a report where either the Replacement or Correction needs to be shown on the report, based on the choices in my form.

The Serial Number (LineItemCodes are from the same table).

Any help will be deeply appreciated.

Thanks, in advanced for any input.

KerryDee
 

Attachments

If the form is going to be open when the report is run then one way to do this is to grab the form values in the Report Open event and decide what to display base on which combo boxes are null. Here's an example that changes the top label Label151


Code:
Private Sub Report_Open(Cancel As Integer)

If IsNull([Forms]![frmOtay]![txtLineItemCodeRe]) = False Then
    Me.Label151.Caption = "Replacement " & [Forms]![frmOtay]![txtLineItemCodeRe] & " was chosen"
ElseIf IsNull([Forms]![frmOtay]![txtLineItemCodeCo]) = False Then
    Me.Label151.Caption = "Correction " & [Forms]![frmOtay]![txtLineItemCodeCo] & " was chosen"
Else
    Me.Label151.Caption = "Nichts, Nada, Nothing was chosen"
End If

End Sub
 
Thank you very much Steve for your prompt response and taking the time to help. Whenever a user choose either Replacement or Correction combo box, either Replacement or Correction fields in the combo box will be generated in a report, not both. The report can only have either Replacement or Correction fields, not both. The report I am supplying is just an example. The "real" report is a prepopulated form. If you notice, in my example, the Replacement (the first field in the combo Serial Number-LineItem Code) box comes up when I choose the correction combo box and the fields are automatically completed. So in effect, only one Combo Box selected fields should appear on the report.

I apologize deeply if I confused you with the Replacement Corrections Labels (unless of course I am confused, and I can use your code to accomplish what I want. I am a novice.

Thanks again very much.

KerryDee
 
I took a closer look at your database and I understand now what you are asking for but I can't propose a good solution with the current database structure.

I suggest you reconsider the design of your tables taking into consideration the principle of database normalization in your design. This series of web pages should give you a good start on these principles.
 
Thanks very much for your help. I will check out the articles.

KerryDee
 

Users who are viewing this thread

Back
Top Bottom