Pro contributor
17Mar2010,16:17   #11
virxen's Avatar
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
Contributor
17Mar2010,16:56   #12
viv345's Avatar
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.
Contributor
17Mar2010,17:36   #13
viv345's Avatar
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
Contributor
18Mar2010,09:51   #14
viv345's Avatar
For example if their two forms with same text and labels can i use
this for loading, centering etc etc

Private Sub Form2_Load ()
Contributor
19Mar2010,15:50   #15
viv345's Avatar
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?
Contributor
19Mar2010,16:02   #16
viv345's Avatar
OK
I found my mistake

Thanks
Contributor
27Mar2010,15:55   #17
viv345's Avatar
Problem Resolved
THANK YOU VERY VERY MUCH FOR YOUR HELP