Hello all,
I am pretty new to Access and VBA both, but I've been getting along pretty good until now. Currently I am getting an error while trying to set the RecordSource property, but I will explain the larger scope in case I am going about it wrong.
I am helping another coworker to develop a database to track issues. An initial form will be used to display information and accept values for different sections of the larger project. All of these will have unique IDs, say 1, 2, 3...
If there is a problem discovered while checking that section, they user will need to be able to click a button to generate an "issue" form. These are stored in another table. Currently the two tables ("sections" and "issues") are interacting fine with each other, I have a lot of different things viewed back and forth between their forms.
What I would like to do, however, is link the unique ID for each issue to the original section (Something like 1.1, 1.2, etc.) My first idea was to populate the "Associated FAT ID#" field (already exists) automatically when an issue is generated, and then use a query to concatenate the associated ID with the primary key of the issues table.
So I made a button and have written the following code:
Code:
Private Sub Generate_Issue_Click()
DoCmd.OpenForm "FAT ISSUES LOG FORM", , , , , , Me.[ID#]
Me.RecordSource = Application.CurrentObjectName
'Me.[Associated FAT ID#] = Me.OpenArgs
MsgBox (Application.CurrentObjectName)
End Sub
I mean for this to open the "Issues" form, generate a new record, and insert the ID from the parent form into the "Associated FAT ID#" field. If I comment out the field with the RecordSource property, it will open the form correctly. With that line in there, however, I get the error:
Code:
Run-time error '2465':
Microsoft access can't find the field 'ID #' referred to in your expression
At first this seemed simple, but I can't find where it is looking for that field, and it should exist in the issues form.
Long explanation, but hopefully I gave you everything. Thanks for any help.