I'm kind of new in regards to working with Access. I've worked mostly with Visual FoxPro, but they wanted this project done in Access, so...
I'm about finished with a project done in Access 2007. The only issue I'm having is coming with the code to print a report based on a value in a field.
Have 1 table, 3 reports, 2 forms.
I need help with the code for my print button, f. ex.:
--------------------------
If table1.Field1 = "A"
strDocument = "Report1"
Else
strDocument = "Report2"
End If
DoCmd.OpenReport StrDocument
--------------------------
This will of course, according to me, print the corresponding Report based on field1 having a value of either "A" or "B".
How can I tell Access to read the value from field1? I'm having trouble coming with the correct syntax. Do I have to create a recordset or a query or can I just access the field values directly?
Thanks for the help.
Johann
I'm about finished with a project done in Access 2007. The only issue I'm having is coming with the code to print a report based on a value in a field.
Have 1 table, 3 reports, 2 forms.
I need help with the code for my print button, f. ex.:
--------------------------
If table1.Field1 = "A"
strDocument = "Report1"
Else
strDocument = "Report2"
End If
DoCmd.OpenReport StrDocument
--------------------------
This will of course, according to me, print the corresponding Report based on field1 having a value of either "A" or "B".
How can I tell Access to read the value from field1? I'm having trouble coming with the correct syntax. Do I have to create a recordset or a query or can I just access the field values directly?
Thanks for the help.
Johann