Is Query Needed to copy an ID from one table to another?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've been using table to enter data regarding Equipment and Equipment
Details. This works fine PK-fk. In trying to use forms with a command
button, if the EquipmentID is not already present in the child table it
simply goes to a new record without the ID.

The command button uses:
stLinkCriteria,,,

I tried an IF statement on the Details form in AfterUpdate

If Me.EquipmentID=Null
Then Me.EquipmentID=frmVsEquipment.EquipmentID

End If

Any suggestions would be most appreciated.
FerryMary
 
No test for = Null will ever be True. The correct syntax is :
If IsNull(Me.EquipmentID) Then
Me.EquipmentID=frmVsEquipment.EquipmentID
End If
 
I'm still screwing something up,,,I've tried it in the form_AfterUpdate(),
BeforeUpdate(),Current and in the textbox AfterUpdate(). It is copied below
with correct form names and IDs. Any help is most appreciated.


FerryMary

Private Sub VslEquipID_AfterUpdate()

If IsNull(Me.VslEquipID) Then
Me.VslEquipID = frmVslEquipment.VslEquipID
End If
End Sub
 
On your subform use the same name of the id. Ie on the mainform and table it
may be an autonumber however on the sub form it need only be a number field.

Goto the subform main properties and where it says the link child and mast
fields or what ever type in or select the properties on the main form and the
sub form that link one to the other...in Design View

Ie EmpId is on main form and in tble as autonumber
EmpId is on sub form and in tble as number

Link Child EmpId
Link Master EmpId

This process will not only properly link them it will copy the number EmpId
from the master form to the subform even on new records.

Dwight
 
Back
Top