arunakumari02
Registered User.
- Local time
- Today, 15:34
- Joined
- Jun 2, 2008
- Messages
- 91
I have a Grid of 3*3 textboxes.
If I enter a new value in grid it should add a row in the table or if I update the existing value in the grid it should edit that record in the table.
I am trying to first find whether that record is there in the entire table then if it does not add the record. If you find it edit the record.
The code below is not working when I edit existing value it is not editing in table but adding a new record?
Any help is appreciated.
If I enter a new value in grid it should add a row in the table or if I update the existing value in the grid it should edit that record in the table.
I am trying to first find whether that record is there in the entire table then if it does not add the record. If you find it edit the record.
The code below is not working when I edit existing value it is not editing in table but adding a new record?
Any help is appreciated.
Code:
[FONT=Times New Roman][SIZE=3]Set rstAvailability = CurrentDb.OpenRecordset(strAvailability)[/SIZE][/FONT]
[SIZE=3][FONT=Times New Roman] Dim strCriteria As String[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] strCriteria = "[MonthAvailable]=" & Forms!filter("txtMonth" & intMonth) & _[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] "[ResourceID]" = Forms!filter("txtResourceID" & intRow)[/FONT][/SIZE]
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]
[SIZE=3][FONT=Times New Roman] [/FONT][/SIZE][SIZE=3][FONT=Times New Roman] rstAvailability.FindFirst (strCriteria)[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] [/FONT][/SIZE][SIZE=3][FONT=Times New Roman] If rstAvailability.NoMatch = True Then[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] Debug.Print "addnew"[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] Else[/FONT][/SIZE]
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]
[SIZE=3][FONT=Times New Roman] Debug.Print "edit"[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] End If[/FONT][/SIZE]