always change the first RECORD from table

G

Guest

I have a main form (Form1)
- in the main form there is a button that open a form (with OpenForm) Form2
- I use this Form2 to select a value from a combobox for filtering option
- the form2 has OK button. On OnCLick event Form3 will be displayed vith
filtering condition.
So, everythink is OK, I receive the data I want to extract from database,
BUT....

In form3 IF I want to modify the data for current record, the information is
change always for first record from table, even if I want to change, for
example, the record no.100.

I have to mention that form1 and form3 has as record source the same table.
 
A

Arvin Meyer [MVP]

Do you have code which modifies the data? If so, please post it. Which
version of Access are you using? Do you have all the Service Packs applied
for your version? We really need to know more to answer your question.
--
Arvin Meyer, MCP, MVP
Free MS-Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"always change the first RECORD from tabl" <always change the first RECORD
from (e-mail address removed)> wrote in message
news:[email protected]...
 
J

John Vinson

On Sun, 3 Sep 2006 03:10:02 -0700, always change the first RECORD from
tabl <always change the first RECORD from
I have a main form (Form1)
- in the main form there is a button that open a form (with OpenForm) Form2
- I use this Form2 to select a value from a combobox for filtering option
- the form2 has OK button. On OnCLick event Form3 will be displayed vith
filtering condition.
So, everythink is OK, I receive the data I want to extract from database,
BUT....

In form3 IF I want to modify the data for current record, the information is
change always for first record from table, even if I want to change, for
example, the record no.100.

I have to mention that form1 and form3 has as record source the same table.

How are you informing the code in Form3 WHICH record is the current
record?

John W. Vinson[MVP]
 
G

Guest

In form3 I have textboxes and one subform. All textboxes and subform are
not enabled. There are 2 buttons: Modify and Delete. Both are enabled. When I
push the Modify button the following code is accessed:

*******************************************
Private Sub Command20_Click()
Dim strMsg As String, strTitle As String
Dim intStyle As Integer
Dim intConst

If Me.Command20.Caption = "Modify" Then

' Se verifica daca intr-adevar se doreste modificare.
strMsg = "Do you really want modify data?"
intStyle = vbYesNo
strTitle = "Modidying data ..."
intConst = MsgBox(strMsg, intStyle, strTitle)

If intConst = vbYes Then
Me.Denumire_produs.Enabled = True
Me.Combo5.Enabled = True
Me.lot.Enabled = True
Me.data_exp.Enabled = True
Me.Dilutii_din_serie.Controls("id_tip_dilutie").Enabled = True
Me.Dilutii_din_serie.Controls("data_exp").Enabled = True

Me.Command21.Enabled = False

Me.Command20.Caption = "Save"

Else
Exit Sub
End If
Else

' Se verifica daca intr-adevar se doreste invalidarea cmapuriloer
strMsg = "Do you want to save data?"
intStyle = vbYesNo
strTitle = "Save data ..."
intConst = MsgBox(strMsg, intStyle, strTitle)

If intConst = vbYes Then


Me.Dilutii_din_serie.Controls("btnDummy").SetFocus

Me.Dilutii_din_serie.Controls("id_tip_dilutie").Enabled = False
Me.Dilutii_din_serie.Controls("data_exp").Enabled = False


Me.btnDummy.SetFocus

Me.Denumire_produs.Enabled = False
Me.Combo5.Enabled = False
Me.lot.Enabled = False
Me.data_exp.Enabled = False

Me.Command21.Enabled = True
Me.Command20.Caption = "Modify"
DoCmd.Close acForm, "Form3"
Else
Exit Sub
End If

End If

End Sub

***************************************************

As you can see I change the value of the property enable into yes for
textboxes. I use this code because when I push the Modify button, DELETE
button will be unenabled and I change the text caption for the Modify button.

After I change the data from the text box (don't forget that when data is
displayed the information is correct and also the data are correct when I
change it). I use the same code (button "Modify" is now "Save") to un-enable
the textboxes and subform.

I don't know if this is the code you expected.....
I use Access 2003 (11.6355.6360) SP1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top