Ashfaque
Search Beautiful Girls from your town for night
- Local time
- Tomorrow, 01:14
- Joined
- Sep 6, 2004
- Messages
- 897
My Below code is working fine which is behind SAVE button. For Next loop reduced the efforts to save data field individually.
Set rst = CurrentDb.OpenRecordset("Select * from T_ProjectBaseContracts where ProjNum='" & ProjNum & "'")
rst.AddNew
For Each fld In rst.Fields
rst(fld.name) = Me(fld.name)
Next fld
rst.Update
I like to use same code with slight changes to UPDATE the record. This time I dont want to same one field i.e. ProjNum (it is primary key and already existing in record) so that after clicking Update btn I dont need to write such a lengthy code like Rst!field=Me!Field for each of my fields on form.
Is this possible?
I want my code to check if ProjNum is same which I have on my current form then other than that rest of the field data should be updated
If rst!ProjNum = Forms!F_Project!ProjNum Then update next field only...something like...
Set rst = CurrentDb.OpenRecordset("Select * from T_ProjectBaseContracts where ProjNum='" & ProjNum & "'")
rst.AddNew
For Each fld In rst.Fields
rst(fld.name) = Me(fld.name)
Next fld
rst.Update
I like to use same code with slight changes to UPDATE the record. This time I dont want to same one field i.e. ProjNum (it is primary key and already existing in record) so that after clicking Update btn I dont need to write such a lengthy code like Rst!field=Me!Field for each of my fields on form.
Is this possible?
I want my code to check if ProjNum is same which I have on my current form then other than that rest of the field data should be updated
If rst!ProjNum = Forms!F_Project!ProjNum Then update next field only...something like...
Last edited: