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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fields won't appear in form after conversion to Access 2003

Status
Not open for further replies.

aruba

Programmer
Sep 5, 2003
47
I have an Access 97 database which I just split into a front-end and back-end. I converted the front-end to Access 2003. One of the forms in the database is based on a query. If the query returns no records, none of the fields appear in the form when I open it.(form looks blank)Any suggestions on how I can the fields to appear even if they are empty?

Thanks to anyone that can help!
 
How are ya aruba . . . . .

In the [blue]On Current[/blue] event of the form, copy/paste the following code ([blue]you[/blue] substitute proper names in [purple]purple[/purple]):
Code:
[blue]   If IsNull(DLookup("[[purple][b]PrimaryKeyName[/b][/purple]]", "[purple][b]QueryName[/b][/purple]")) Then
      Me.DataEntry = True
   Else
      Me.DataEntry = False
   End If[/blue]
Thats it . . . give it a whirl & let me know . . . .

Calvin.gif
See Ya! . . . . . .
 
Aruba:
Aceman1's advice should work fine. Another point I've run into is that a lot of users think something is wrong with the system when they run a query and get nothing back. I use DCount to check to see whether any records have been returned by the query, and if not I have a message box pop up informing them of this. Then when they acknowledge the message by clicking OK I return them to the screen they came from. This way they know that the query has actually been run, and don't waste time re-running it, then finally calling IT to find out what's wrong with the system!

Hope this helps.

The Missinglinq

"It's got to be the going,
not the getting there that's good!"
-Harry Chapin
 
aruba . . . . .

Thanks to a wake-up from [blue]missinglinq[/blue], the DCount would work much faster, espcially if you have alot of records. So trash the previous code and use the following:
Code:
[blue]   If DCount("[[purple][b]PrimaryKeyName[/b][/purple]]", "[purple][b]QueryName[/b][/purple]") = 0 Then
      Me.DataEntry = True
   Else
      Me.DataEntry = False
   End If[/blue]

Calvin.gif
See Ya! . . . . . .
 
Thanks! But it still doesn't work when I change Data Entry to Yes. The title in the Header displays, but nothing in the details section is shown. I use this form as a data input form and it works fine on Access97.
 
aruba . . . . . .

In that case, I would backup the BackEnd and convert it as well.

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top