Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DLookup Overflow problem

Status
Not open for further replies.

Trudye

Programmer
Sep 4, 2001
932
0
0
US
On previous form I was able to add a combo box to a subform. However this time I have encountered a new problem. The problem is more records are involved in my current subform.

The first combo Box/subform I created it was ok to use the DlookUp function because the record count was on average 2 records. But now my record count on average 10 records. I am getting the following error msg.

Run-time error '6
Overflow

Here is my code:
Private Sub Command150_Click()
Dim src As Integer

src = DLookup([MAWBID], "HAWB_Imports", "MAWBid = " & Me.MAWBID)

'This updates the combo box of my subform
Me.Combo158 = src
Me.Combo158.Requery

'This makes the combo box, subform and main form equal
Combo158_AfterUpdate
End sub


I tried a CLng function but couldn't get it to work (it could have and probably was me).

Does anyone have any suggestions?

Thank you
 
You have

Dim src As Integer

but I'm guessing that MAWBID is a primary key (AutoNumber?) field in your table, and so it is most likley a long intger,. and that's where your overflow error is being caused.

Change the declaration of src to...

Dim scr as Long
 
Thanks LambertH:

I finally figured it out, you are correct I did need to change my DIM designation. after changing a few things around it works perfectly


Be well,
Trudye
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top