MS ACCESS VBA If Form textbox value in table and date is not null then

Need to write VBA to determine if a textbox value is in table then . . . update table
deer777Asked:
Who is Participating?
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Connect With a Mentor Infotrakker SoftwareCommented:
You'll have to give a little more detail.

Do you want to determine if the value exists in a specific column in the table? Or in several columns in the table?

You can use DCount to determine if it exists in a single column:

If Nz(Dcount("*", "YourTable", "YourColumn=" & Me.YourTextbox), "") <> "" Then
  '/ the value exists
Else
  '/ the value does not exist

You'd have to show us the stored proc in order for us to provide you with specific advice on running that.
End If
0
 
deer777Author Commented:
then I need to run stored procedure to insert into table on the SQL Server side
0
 
PatHartmanCommented:
VBA doesn't directly access tables.  You would do this by creating an update query that selects the record you want to update if the value is null and sets the value to whatever you want.

I'm guessing that you are making this harder than it needs to be.  Are you not using a bound form?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.