Re: VBA SQL
- From: Starke <starke1120@xxxxxxxxxxx>
- Date: Tue, 31 Jul 2007 07:59:16 -0700
On Jul 31, 10:51 am, "Baz" <b...@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
Set rsVendor = db.OpenRecordset(sqlVendor)
If rsVendor.BOF and rsVendor.EOF Then
'Whatever you want to do if there's no record
Else
strVenName = rsVendor!vendor_name
End If
However, you might find this easier than rewriting all your domain aggregate
function calls:
http://www.mvps.org/access/modules/mdl0012.htm
"Starke" <starke1...@xxxxxxxxxxx> wrote in message
news:1185892524.364073.198620@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I have a database that I am converting to a mysql backend so I can
access it across a wan a little better (hopefully).. Im converting my
DLookups to sql statements but I have an issue when they return no
records. See below for the code. Also, what are your thoughts of
converting the access db to a mysql backend with use over a t1 wan?
Thanks,
Dave
Set db = CurrentDb
sqlVendor = "SELECT vendor_name from tblClaims " & _
"Where purchase_order ='" & Me.txtPO & "'"
sqlTransExist = "SELECT id from tblClaims " & _
"Where purchase_order ='" & Me.txtPO & "'" & _
" and manager_id = 2"
Set rsVendor = db.OpenRecordset(sqlVendor)
strVenName = rsVendor!vendor_name
' ----------- my problem is here, when sqlVendor returns no record,
I get a box that pops up ' ---------------and says 'No Current Record'
once I try to assign strVenName the value.. any help '---------------
would be appreciated./.
Set rsTransExist = db.OpenRecordset(sqlTransExist)
If IsNull(rsTransExist) Then
Me.lblTransExist.Caption = "NO"
Else
Me.lblTransExist.Caption = "YES"
End If
Great!!! That worked, I'll take a look at your suggestion as well. I
was trying to test for Null and of course that wasnt working..
.
- References:
- VBA SQL
- From: Starke
- Re: VBA SQL
- From: Baz
- VBA SQL
- Prev by Date: Re: VBA SQL
- Next by Date: Re: Crashing of Access 97
- Previous by thread: Re: VBA SQL
- Next by thread: Re: VBA SQL
- Index(es):
Relevant Pages
|
|