Data from one form to another

ddrew

seasoned user
Local time
Today, 13:28
Joined
Jan 26, 2003
Messages
911
I want some data from a form Lets call it "Karate 1" To appear in a field on Form "Karate 2"someone told me about Strings and what have you but I dont really understand

I think it should look something like this but?

If Red_Score=1 then Let Me.List11 =Red_Name
If White_Score =1 then Let Me.List11=White_Name

I know theres some stuff missing

Red_Score, White_Score, Red_Name and White_Name are all fields on Karate1

Help :confused:
 
To reference another form use its name. When you code "Me" you're referencing the current form. Basically replace the "Me" with the actual form name to "point" to another form.
i.e. Forms!FormName.ControlName
i.e. Forms!Karate2.List11 = Forms!Karate1.Red_Score

Search in help for "references" too.
 
Hm!

Think i'm almost there now bot i'm not getting the names on to "Karate 2" so I guess the code is cancelling itself out. Any ideas

If Me.RedScore = 1 Then Let Forms!Karate2!List20 = Me.RedName
If Me.WhiteScore = 1 Then Let Forms!Karate2!List20 = Me.WhiteName
 

Attachments

  • karate.jpg
    karate.jpg
    53.9 KB · Views: 136
Slight change. Try changing the ! to . b/4 List20.

If Me.RedScore = 1 Then Let Forms!Karate2.List20 = Me.RedName
If Me.WhiteScore = 1 Then Let Forms!Karate2.List20 = Me.WhiteName
 
Still not quite there. Ive copied the code in from the actual form, if you look at the JPG from my previous post, this code is from the button marked "Round 2"

Hope you can help

Private Sub Round_2_Click()
On Error GoTo Err_Round_2_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Karate2"
DoCmd.OpenForm stDocName, , , stLinkCriteria

If Me.Red_Score = 1 Then Let Forms!Karate2.List16 = Me.Red_Name
If Me.White_Score = 1 Then Let Forms!Karate2.List16 = Me.White_Name

Exit_Round_2_Click:
Exit Sub

Err_Round_2_Click:
MsgBox Err.Description
Resume Exit_Round_2_Click

End Sub:confused: :confused:
 
What's supposed to be happening? Are the White_Name and Red_Name in the bottom form supposed to match the top form? Or are you trying to add items to your listbox on the right? I don't know what your control names refer to.

I've personally never used "Let" statement, but that doesn't mean it's not going to work. You may want to try an if statement like the one below.

If Me.Red_Score = 1 Then
Forms!Karate2.List16 = Me.Red_Name
Else If Me.White_Score = 1 Then
Forms!Karate2.List16 = Me.White_Name
End if

If that doesn't work, try enclosing the Me.[White_Name]. I'm not sure that will help, but it's worth a try. I personally don't like the underscore so I name things like WhiteName w/o the underscore_.

It seems that the control names you're referencing change from post to post. Make sure they're correct.

Let me know.

HTH
 
CRACKED IT!!!!!

I was over complicating things

Thanks for all your help.

"If at first you dont succed,

try, try, try again.

Then drop kick it out the window!!!!!!":)
 

Users who are viewing this thread

Back
Top Bottom