0
virxen's Avatar, Join Date: Nov 2009
Pro contributor
Quote:
Originally Posted by viv345 View Post
I want know one more thing that if their are more forms in a project viz., Form 1, Form2 etc etc then what will be the coding.
AND
In this project on this command it is giving error
Run-time error '3704'
Operation is not allowed when the object is closed


Private Sub Command8_Click() 'save button
rec.AddNew
rec.Fields(1) = Text1.Text
rec.Fields(2) = Text2.Text
rec.Fields(3) = Text3.Text
rec.Fields(4) = Text12.Text
rec.Fields(5) = Text13.Text
rec.Update
MsgBox "record stored"
currentRecord = currentRecord + 1
Label3.Caption = "Record " + CStr(currentRecord) + " of " + CStr(rec.RecordCount)

End Sub
from the code above i assume that you run your code with the changes i did,
not my project.

check your code again,somewhere in your code you must have left something like
rec.close remove it and it should be ok.


viv345 like this
0
viv345's Avatar, Join Date: Feb 2010
Contributor
Yes i tried to change the fields. Just to see that, if I change the boxes or text.box what will happen will it work or not. If not where i am wrong.
Thanks for your help.
0
viv345's Avatar, Join Date: Feb 2010
Contributor
Sir,
No such (rec.close) is given in code
Only code for centering form and go back is given viz

Private Sub Form2_Load()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
End Sub

AND

Private Sub Command7_Click()
Form1.Show
Form2.Visible = False
End Sub


FOR (GOBACK) is given
0
viv345's Avatar, Join Date: Feb 2010
Contributor
For example if their two forms with same text and labels can i use
this for loading, centering etc etc

Private Sub Form2_Load ()
0
viv345's Avatar, Join Date: Feb 2010
Contributor
Getting Problem when I write code :-
Private Sub Form_Load()
deleting = False

connect
Label2.Caption = "Record " + CStr(currentRecord) + " of " + CStr(rec.RecordCount)


If Not rec.EOF Then

Text3.Text = rec.Fields(1).Value
Text2.Text = rec.Fields(2).Value
Text12.Text = rec.Fields(3).Value
Text13.Text = rec.Fields(4).Value
End If
End Sub

It gives error in :-

Private Sub Command8_Click() 'save button
rec.AddNew

rec.Fields(1) = Text3.Text
rec.Fields(2) = Text2.Text gives error
rec.Fields(3) = Text12.Text
rec.Fields(4) = Text13.Text
rec.Update
MsgBox "record stored"
currentRecord = currentRecord + 1
Label2.Caption = "Record " + CStr(currentRecord) + " of " + CStr(rec.RecordCount)
End Sub

If I use :-

[/B]Private Sub Form2_Load()[/B]
deleting = False

connect
Label2.Caption = "Record " + CStr(currentRecord) + " of " + CStr(rec.RecordCount)


If Not rec.EOF Then

Text3.Text = rec.Fields(1).Value
Text2.Text = rec.Fields(2).Value
Text12.Text = rec.Fields(3).Value
Text13.Text = rec.Fields(4).Value
End If
End Sub

It Gives error in :-

Private Sub Command8_Click() 'save button
rec.AddNew gives error here

rec.Fields(1) = Text3.Text
rec.Fields(2) = Text2.Text
rec.Fields(3) = Text12.Text
rec.Fields(4) = Text13.Text
rec.Update
MsgBox "record stored"
currentRecord = currentRecord + 1
Label2.Caption = "Record " + CStr(currentRecord) + " of " + CStr(rec.RecordCount)

End Sub

Please tell me where I am wrong?
0
viv345's Avatar, Join Date: Feb 2010
Contributor
OK
I found my mistake

Thanks
0
viv345's Avatar, Join Date: Feb 2010
Contributor
Problem Resolved
THANK YOU VERY VERY MUCH FOR YOUR HELP