I have a main form called WorkOrderSummary where it is part information, and part navigation. In the Detail body I have several fields of information based on queries and tables. In the footer of the form I have numerous navigation buttons to forms that have in common the fields [AssetNo] and [WONumber] with the main form in the detail body.
What is currently working correctly is a form will open blank, and once I fill in the two fields, I can close it and the button will open it back up with those values in tact.
What I am trying to do is when I pick on one of these buttons, it will first look to see if a record exists with the two above fields. If so then it simply opens the form, but if not then I need it to automatically fill in those fields and create a new record.
I have found several posts and websites that touch upon this subject, but getting it to work with my forms has been met with failure so far. The option that seems to be the best is to use the OpenForm Method, utilizing OpenArgs in an expression. I am able to open a form properly when a record exists, and I can open a blank form when they don't exist, but I am stuck at automatically filling in the fields when no records exist. I am using a Macro to do this, and I am thinking I need to convert this to VBA code in order to provide multiple arguments.
Can I get some help with the VBA to accomplish this? One of the forms I am trying to open is called “CylinderTests”.
My macro looks like this:
OpenForm
Form Name: CylinderTests
View: Form
Filter Name: Blank
Where Condition: ="[WONumber]=" &[WONumber]
Data Mode: Blank
Window Mode: Dialog
[WONumber] is the main link between all of my forms. It's a field in the WorkOrderSummary table that is an auto-number. I will have several forms that use the same [AssetNO], but the [WONumber] is truly unique. It's combining of the two where I am hitting my wall.
Thanks in advance!
What is currently working correctly is a form will open blank, and once I fill in the two fields, I can close it and the button will open it back up with those values in tact.
What I am trying to do is when I pick on one of these buttons, it will first look to see if a record exists with the two above fields. If so then it simply opens the form, but if not then I need it to automatically fill in those fields and create a new record.
I have found several posts and websites that touch upon this subject, but getting it to work with my forms has been met with failure so far. The option that seems to be the best is to use the OpenForm Method, utilizing OpenArgs in an expression. I am able to open a form properly when a record exists, and I can open a blank form when they don't exist, but I am stuck at automatically filling in the fields when no records exist. I am using a Macro to do this, and I am thinking I need to convert this to VBA code in order to provide multiple arguments.
Can I get some help with the VBA to accomplish this? One of the forms I am trying to open is called “CylinderTests”.
My macro looks like this:
OpenForm
Form Name: CylinderTests
View: Form
Filter Name: Blank
Where Condition: ="[WONumber]=" &[WONumber]
Data Mode: Blank
Window Mode: Dialog
[WONumber] is the main link between all of my forms. It's a field in the WorkOrderSummary table that is an auto-number. I will have several forms that use the same [AssetNO], but the [WONumber] is truly unique. It's combining of the two where I am hitting my wall.
Thanks in advance!