B
bobby
Hi
I'm trying to open an existing record in an amendment form.
The user enters the ref_number in form with a text box and button and this
opens new form passing the ref_number as OpenArgs.
I get an error 'Runtime 3464 data type mismatch in criteria expression.' and
the debugger highlights the line begining Set rst = db.openrecordset ....etc
Here's the code
--------------------------------------------
Private Sub Form_Load()
Dim db As Database, rst As Recordset, link As Integer
link = Me.OpenArgs
Set db = CurrentDb
Set rst = db.OpenRecordset("SELECT * FROM tbl_main_data WHERE
(ref_number = '" & link & "')")
rst.MoveFirst
------------------------------------------
When I hover the pointer over & link & it shows the numerical value in
tooltip.
Also ref_numberis the primary key (autonumber).
Currently I have the form working with it being bound to the query but this
means that users are opening the form and changing data on the form without
realising that the changes are immediately reflected in the data. I'm aiming
to to populate the form, allow them to make changes and then only commit to
the change by pressing a save button.
Any help appreciated
I'm trying to open an existing record in an amendment form.
The user enters the ref_number in form with a text box and button and this
opens new form passing the ref_number as OpenArgs.
I get an error 'Runtime 3464 data type mismatch in criteria expression.' and
the debugger highlights the line begining Set rst = db.openrecordset ....etc
Here's the code
--------------------------------------------
Private Sub Form_Load()
Dim db As Database, rst As Recordset, link As Integer
link = Me.OpenArgs
Set db = CurrentDb
Set rst = db.OpenRecordset("SELECT * FROM tbl_main_data WHERE
(ref_number = '" & link & "')")
rst.MoveFirst
------------------------------------------
When I hover the pointer over & link & it shows the numerical value in
tooltip.
Also ref_numberis the primary key (autonumber).
Currently I have the form working with it being bound to the query but this
means that users are opening the form and changing data on the form without
realising that the changes are immediately reflected in the data. I'm aiming
to to populate the form, allow them to make changes and then only commit to
the change by pressing a save button.
Any help appreciated