raggajunglist
Registered User.
- Local time
- Yesterday, 18:04
- Joined
- Aug 30, 2007
- Messages
- 40
Afternoon all ,
Im running 2003 with a BE/FE setup (all in Access)
I have a piece of code which doesn't seem to work and wont give me any error messages.
I believe it is something to do with there being no records in this recordset but no matter how hard i try to work around it, i cant (especially with no error messages!!!!)
Here is the offending bit of code:
Sub rstAdds()
Dim objDb
Dim fld
Dim repName
repName = GetAbvName()
Const dbOpenDynaset% = 2
Set objDb = CurrentDb.OpenRecordset("tblAddresses" & repName, dbOpenDynaset)
For Each fld In objDb.Fields
If fld.Name = "Street" And Nz(fld.Value, "") = "" Then
GoTo endMe:
Else
If fld.Name = "AccNum" And Nz(fld.Value, "") = "" Then
objDb.Edit
objDb.Fields("AccNum").Value = Forms!frmMainEmpty!txtAccNum.Value
objDb.Fields("RepID").Value = GetCurrentUserName()
objDb.update
objDb.Close
Set objDb = Nothing
End If
End If
Next fld
endMe:
End Sub
Any help is greatly appreciated, im getting no end of problems because of this.
Thanks in advance.
Mike
Im running 2003 with a BE/FE setup (all in Access)
I have a piece of code which doesn't seem to work and wont give me any error messages.
I believe it is something to do with there being no records in this recordset but no matter how hard i try to work around it, i cant (especially with no error messages!!!!)
Here is the offending bit of code:
Sub rstAdds()
Dim objDb
Dim fld
Dim repName
repName = GetAbvName()
Const dbOpenDynaset% = 2
Set objDb = CurrentDb.OpenRecordset("tblAddresses" & repName, dbOpenDynaset)
For Each fld In objDb.Fields
If fld.Name = "Street" And Nz(fld.Value, "") = "" Then
GoTo endMe:
Else
If fld.Name = "AccNum" And Nz(fld.Value, "") = "" Then
objDb.Edit
objDb.Fields("AccNum").Value = Forms!frmMainEmpty!txtAccNum.Value
objDb.Fields("RepID").Value = GetCurrentUserName()
objDb.update
objDb.Close
Set objDb = Nothing
End If
End If
Next fld
endMe:
End Sub
Any help is greatly appreciated, im getting no end of problems because of this.
Thanks in advance.
Mike