Looking up table data in Access 2000 VBA - TechRepublic
General discussion
March 1, 2001 at 05:24 AM
gemailhiot

Looking up table data in Access 2000 VBA

by gemailhiot . Updated 25 years, 3 months ago

I am developing an application, my first one, using Access 2000 and VBA.

I have a table containing all the pay periods for 2001. I need to check a date entered on a form as being in the right pay period.

I have created code for an OnExit Eventat the data entry date field.

the code is as follows:

Dim dbs as Database
Dim rsPay as Recordset

Set dbs = OpenDatabase(“x.mdb”)
set rsPay = New Recordset
rsPay.Open “SELECT * FROM [Pay Period], DBQ=x.mdb, WHERE (Start_Date <= Combo6 and Stop_Date >= Combo6), adOpenTable

Combo6 refers to the entered date. Date format is the same in the table as in the form – short date mm/dd/yy.

The above code is just one of the last iteration and attempt to get at those records. Every time the system returns the message “Type Mismatch”. I find that the VBA help is less than helpful on the topic.

Anyone got a suggestion or another technique for achieving the same results?

thanks

gilles mailhiot

This discussion is locked

All Comments