Have one of those runtime errors that I can't figure out.
I am trying to open a form from another. This is based on the Northwind DB. I got it to work OK in the Northwind DB, but doesn't when I change to suit mine.
I have two forms: frmTrainers and frmTrainerDetails and the idea is that when the users types in the TrainerID, the frmTrainerDetails should open. After typing in the ID is when I get the Run-time error.
This is the code:
Dim Msg As String
Dim Title As String
Dim Answer As String
Msg = "Enter a Trainer ID"
Title = "Open Trainer Details Form"
Answer = InputBox(Msg, Title)
If Answer <> "" Then
DoCmd.OpenForm "frmTrainers", , , "[TrainerID]='" & Answer & "' "
When running the de-bugging facility, the error is ponted at : DoCmd.OpenForm "frmTrainers", , , "[TrainerID]='" & Answer & "' "
Can anyone give me a hand to sort this out. Spent hour trying to figure it out!
Yes. frmTrainers is the open page. I have changed DoCmd.OpenForm "frmTrainers", , , "[TrainerID]='" & Answer & "' "
to DoCmd.OpenForm "frmTrainerDetails", , , "[TrainerID]='" & Answer & "' " but I still get the same error.
Without knowing what the actual error is, I have to assume (by looking at your code) that perhaps you are getting a Type Mismatch error (???). Just quessing here but if [TrainerID] is a number field in your table then you should Dim Answer as to what the table field is.