S
Sara
I've had a little help with my current project so far,
thank you. Now we have a need to add records, and I'm
stuck. Here's the situation.
I have a form that shows employees from the Employee
table. On it I have a subform that displays related
employee records - Employee Charges (related by EENum). I
can select a record and edit - just fine.
My problem is when I want to ADD a new Charge record. I
have an "Add Charge" button on the main form. When the
user clicks that, I want to open a form "Add Charge" and
pre-fill the form with Employee Number, Name (from the
Employee Table) and Date (I use yesterday - all set there)
and Location. I take Location from the latest record on
the subform (Employee Charges). Date and Location do not
appear on the Employee Table, only on Employee Charges.
My problem is that when I open the Add Charge form, I
can't get the information to show up. I declare all my
variables, then use code (with a MsgBox first to see the
criteria for testing - criteria is correct) to open the
form. I think it might be something to do with the Data
Source for the form, but I've had no luck figuring it out
with Help, Northwind and trial and error.
Here's the code:
DCL (all variables declared)
sDoCmd.OpenForm "F_AddCharge",,,stlinkCriteria.
StlinkCriteria, for one example, is Employee 1084, Date
8/14/04 and Location 12.
Any ideas where I went wrong?
Many thanks.
Sara
thank you. Now we have a need to add records, and I'm
stuck. Here's the situation.
I have a form that shows employees from the Employee
table. On it I have a subform that displays related
employee records - Employee Charges (related by EENum). I
can select a record and edit - just fine.
My problem is when I want to ADD a new Charge record. I
have an "Add Charge" button on the main form. When the
user clicks that, I want to open a form "Add Charge" and
pre-fill the form with Employee Number, Name (from the
Employee Table) and Date (I use yesterday - all set there)
and Location. I take Location from the latest record on
the subform (Employee Charges). Date and Location do not
appear on the Employee Table, only on Employee Charges.
My problem is that when I open the Add Charge form, I
can't get the information to show up. I declare all my
variables, then use code (with a MsgBox first to see the
criteria for testing - criteria is correct) to open the
form. I think it might be something to do with the Data
Source for the form, but I've had no luck figuring it out
with Help, Northwind and trial and error.
Here's the code:
DCL (all variables declared)
sDoCmd.OpenForm "F_AddCharge",,,stlinkCriteria.
StlinkCriteria, for one example, is Employee 1084, Date
8/14/04 and Location 12.
Any ideas where I went wrong?
Many thanks.
Sara