Connecting Tech Pros Worldwide Forums | Help | Site Map

Auto populate field based on recordset and coding

BK
Guest
 
Posts: n/a
#1: Nov 12 '05
Hi,

I have a problem. I need to auto populate fields based on a value
entered in combo box. Initially, I put all the required fields in the
combo box, and hide it (set to 0",0",0", ...), then use code:
Name=cbBox.column(3) to get the value.

It works fine, but I have problem with performance. The source of the
combo box is a table from another database that keeps adding up
(currently we have around 1500 records, around 5-20 new records per
day). The form that use combo box is very slow if doing it that way. I
tried to do something else, with codes mostly, but it doesn't work.
Here's my code:

Private Sub cbJobList_AfterUpdate()

Dim strSQL As String
Dim rs As Recordset

strSQL = "SELECT * from tblJobTicket WHERE JobJacketNo = " &
Me.cbJobList
Set rs = CurrentDb.OpenRecordset(strSQL) '<--gives me data type
mismatch

Me.ComboNo = rs("ComboNo").Value
.......

End Sub

Mostly it gives me datatype mismatch. If I autopopulate the fields
from the codes instead of from the combo box, would it be faster? This
code works fine on the other database, but not mine. Please help. I'm
not very familiar with coding but I'm learning (have to).

Thanks for any help/advise.

BK

Closed Thread